diff --git a/README.md b/README.md index 96e02f8..4917164 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,11 @@ driver: container into another network). - IPv6 is not currently supported +## Configuring + +To change the prefix used for the interface in containers that Docker runs, set the `CALICO_LIBNETWORK_IFPREFIX` environment variable. +* The default value is "cali" + ## Troubleshooting ### Logging diff --git a/driver/package.go b/driver/package.go index d51f872..46360a8 100644 --- a/driver/package.go +++ b/driver/package.go @@ -1,5 +1,7 @@ package driver +import "os" + const ( // Calico IPAM module does not allow selection of pools from which to allocate // IP addresses. The pool ID, which has to be supplied in the libnetwork IPAM @@ -9,6 +11,13 @@ const ( PoolIDV6 = "CalicoPoolIPv6" CalicoGlobalAddressSpace = "CalicoGlobalAddressSpace" - - IFPrefix = "cali" ) + +var IFPrefix = "cali" + +func init() { + if os.Getenv("CALICO_LIBNETWORK_IFPREFIX") != "" { + IFPrefix = os.Getenv("CALICO_LIBNETWORK_IFPREFIX") + } +} +