Skip to content

Control interface name in docker multiple networking #25181

@satyajitbm

Description

@satyajitbm

With the workaround suggested in #17796 for multiple network mode for docker containers, it is not possible to control the interface name with the docker network connect command. The order of the ethx interfaces after docker start is not consistent with the sequence of docker connect commands. Only the network added in the docker create command comes up as eth0 and is consistent.

My post boot script relies on the name of the interfaces and won't work if the order is changed and I require the interfaces to be up on boot. So, I can't use pipework script with the -iflag as well.

Output of docker version:

Client:
 Version:      1.11.2
 API version:  1.23
 Go version:   go1.5.4
 Git commit:   b9f10c9
 Built:        Wed Jun  1 21:23:11 2016
 OS/Arch:      linux/amd64

Server:
 Version:      1.11.2
 API version:  1.23
 Go version:   go1.5.4
 Git commit:   b9f10c9
 Built:        Wed Jun  1 21:23:11 2016
 OS/Arch:      linux/amd64

Output of docker info:

Containers: 6
 Running: 6
 Paused: 0
 Stopped: 0
Images: 24
Server Version: 1.11.2
Storage Driver: devicemapper
 Pool Name: docker-253:0-877344-pool
 Pool Blocksize: 65.54 kB
 Base Device Size: 107.4 GB
 Backing Filesystem: ext4
 Data file: /dev/loop0
 Metadata file: /dev/loop1
 Data Space Used: 4.141 GB
 Data Space Total: 107.4 GB
 Data Space Available: 103.2 GB
 Metadata Space Used: 4.489 MB
 Metadata Space Total: 2.147 GB
 Metadata Space Available: 2.143 GB
 Udev Sync Supported: true
 Deferred Removal Enabled: false
 Deferred Deletion Enabled: false
 Deferred Deleted Device Count: 0
 Data loop file: /var/lib/docker/devicemapper/devicemapper/data
 WARNING: Usage of loopback devices is strongly discouraged for production use. Either use `--storage-opt dm.thinpooldev` or use `--storage-opt dm.no_warn_on_loop_devices=true` to suppress this warning.
 Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
 Library Version: 1.02.107-RHEL7 (2016-06-09)
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host null
Kernel Version: 3.10.0-229.20.1.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 31.24 GiB
Name: vspdemo1.mv.nuagenetworks.net
ID: JTCU:HSQR:NBHL:6T2O:JN32:JZHQ:IBIH:K3ZW:IHV5:LX2V:BILX:YM4R
Docker Root Dir: /var/lib/docker
Debug mode (client): false
Debug mode (server): false
Registry: https://index.docker.io/v1/
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled

Additional environment details: Running on a centos 7.1 bare metal.
uname -a
Linux "REDACTED" 3.10.0-229.20.1.el7.x86_64 #1 SMP Tue Nov 3 19:10:07 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Steps to reproduce the issue:

  1. docker network create --driver bridge --subnet 10.100.1.0/24 net1
  2. docker network create --driver bridge --subnet 10.100.2.0/24 net2
  3. docker network create --driver bridge --subnet 10.100.3.0/24 net3
  4. docker network create --driver bridge --subnet 10.100.4.0/24 net4
  5. docker create -it --net=net1 --ip=10.100.1.3 --name=test centos:7
  6. docker network connect --ip 10.100.2.3 net2 test
  7. docker network connect --ip 10.100.3.3 net3 test
  8. docker network connect --ip 10.100.4.3 net4 test
  9. docker start test
  10. docker exec -it test yum install -y net-tools
  11. docker exec -it test ifconfig

Results received: eth2 was assigned 10.100.4.3 and eth3 was assigned 10.100.3.3

Results expected: eth2 must be assigned 10.100.3.3 and eth3 must be assigned 10.100.4.3 or there needs to be a way to specify the interface name in docker network connect command.

The issue happens occasionally and the probability of it occurring increases with the increase in the number of networks the container is connected to.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/networkingNetworkingkind/enhancementEnhancements are not bugs or new features but can improve usability or performance.version/1.11

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions