Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"docker run" does not connect to more than one network #35543

Closed
djmaze opened this issue Nov 19, 2017 · 2 comments · Fixed by #45906
Closed

"docker run" does not connect to more than one network #35543

djmaze opened this issue Nov 19, 2017 · 2 comments · Fixed by #45906
Labels
area/networking area/swarm kind/enhancement Enhancements are not bugs or new features but can improve usability or performance. version/17.10

Comments

@djmaze
Copy link
Contributor

djmaze commented Nov 19, 2017

Description

Steps to reproduce the issue:

  1. Create two networks:

     docker network create test
     docker network create test2
    
  2. Try to run a container attached to both networks and output the IPs:

     docker run -it --rm --network test --network test2 busybox ip a
    

Describe the results you received:

There is only one network present (apart from the loopback one). Example output:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
45343: eth0@if45344: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1500 qdisc noqueue 
    link/ether 02:42:ac:16:00:02 brd ff:ff:ff:ff:ff:ff
    inet 172.22.0.2/16 scope global eth0
       valid_lft forever preferred_lft forever

Describe the results you expected:

There should be three interfaces (including loopback) including the two networks specified.

Additional information you deem important (e.g. issue happens only occasionally):

docker run seems to only take into account the last network specified at the commandline.

Output of docker version:

Client:
 Version:      17.10.0-ce
 API version:  1.33
 Go version:   go1.8.3
 Git commit:   f4ffd25
 Built:        Tue Oct 17 19:04:16 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.10.0-ce
 API version:  1.33 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   f4ffd25
 Built:        Tue Oct 17 19:02:56 2017
 OS/Arch:      linux/amd64
 Experimental: false

Output of docker info:

Containers: 5
 Running: 4
 Paused: 0
 Stopped: 1
Images: 8
Server Version: 17.10.0-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: active
 NodeID: novju2obbkwighigowx8slr76
 Is Manager: true
 ClusterID: 2dbj37zxgyf0iv9pk0ncozg6f
 Managers: 1
 Nodes: 3
 Orchestration:
  Task History Retention Limit: 5
 Raft:
  Snapshot Interval: 10000
  Number of Old Snapshots to Retain: 0
  Heartbeat Tick: 1
  Election Tick: 3
 Dispatcher:
  Heartbeat Period: 5 seconds
 CA Configuration:
  Expiry Duration: 3 months
  Force Rotate: 0
 Autolock Managers: false
 Root Rotation In Progress: false
 Node Address: 192.158.50.11
 Manager Addresses:
  192.158.50.11:2377
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 06b9cb35161009dcb7123345749fef02f7cea8e0
runc version: 0351df1c5a66838d0c392b4ac4cf9450de844e2d
init version: 949e6fa
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.4.0-98-generic
Operating System: Ubuntu 16.04.3 LTS
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 992.1MiB
Name: longhorn-01
ID: FS4U:GCWE:MPIQ:EFZU:Y43S:GCLM:PQX3:PYHR:5BIY:A4KA:Q5GU:TNVV
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

WARNING: No swap limit support

Additional environment details (AWS, VirtualBox, physical, etc.):

This is on Ubuntu 16.04, but the same happens on Arch Linux as well. Tested on Docker swarm hosts only.

@thaJeztah
Copy link
Member

Thanks for reporting; allowing multiple networks to be provided on docker run has come up a few times in the past; #17750, #17289, and #17796).

The reason it's currently not supported, is that there are some options that can only be provided on a per-container basis (e.g. --network-alias).

I opened a proposal for implementing an "advanced" syntax for --network, so that these options can be specified per-network; see #31964, and docker/cli#317, which implements this in the CLI.

@thaJeztah
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/networking area/swarm kind/enhancement Enhancements are not bugs or new features but can improve usability or performance. version/17.10
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants