-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Description
Description
The documentation is unclear on whether multiple networks can be specified when executing docker run.
There are old issues like this one that claim a container can only be started with one network, or this StackOverflow question whose answer links to a no-longer-existent page on docker.com that says "Docker only allows a single network to be specified with the docker run command."
Is this still the case? The documentation is silent on the topic, and the error messages leave it ambiguous.
Reproduce
$ docker run --rm -it --network foo --network bar alpine:latest
docker: Error response from daemon: Container cannot be connected to network endpoints: foo, bar
Expected behavior
The error message and documentation should be clear about whether multiple networks are supported.
If multiple networks are not supported, and I pass multiple --network flags, please display a concise error message like "Only one network can be specified when starting a container. Additional networks can be attached later with docker network connect."
If multiple networks are supported, this must have been a change in the last few years. Some sentence about this in the documentation confirming which version this was supported in would be useful.
docker version
Client: Docker Engine - Community
Version: 20.10.21
API version: 1.41
Go version: go1.18.7
Git commit: baeda1f
Built: Tue Oct 25 18:00:48 2022
OS/Arch: linux/arm64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.21
API version: 1.41 (minimum version 1.12)
Go version: go1.18.7
Git commit: 3056208
Built: Tue Oct 25 17:59:09 2022
OS/Arch: linux/arm64
Experimental: false
containerd:
Version: 1.6.10
GitCommit: 770bd0108c32f3fb5c73ae1264f7e503fe7b2661
runc:
Version: 1.1.4
GitCommit: v1.1.4-0-g5fd4c4d
docker-init:
Version: 0.19.0
GitCommit: de40ad0docker info
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Docker Buildx (Docker Inc., v0.9.1-docker)
compose: Docker Compose (Docker Inc., v2.12.2)
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 7
Server Version: 20.10.21
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc io.containerd.runc.v2 io.containerd.runtime.v1.linux nvidia
Default Runtime: runc
Init Binary: docker-init
containerd version: 770bd0108c32f3fb5c73ae1264f7e503fe7b2661
runc version: v1.1.4-0-g5fd4c4d
init version: de40ad0
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.253-tegra
Operating System: Ubuntu 18.04.6 LTS
OSType: linux
Architecture: aarch64
CPUs: 8
Total Memory: 31.18GiB
Name: ifcb110
ID: ZO22:42WT:U6GF:LMQP:JE2S:ZZEA:I2FU:XTJL:BZCB:AU2C:GCS2:Q6CZ
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: falseAdditional Info
No response