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

Feature request for docker run: Ability to connect to multiple networks #2455

Open
felixb95 opened this issue Apr 20, 2020 · 3 comments
Open

Comments

@felixb95
Copy link

felixb95 commented Apr 20, 2020

Hi,

most of my containers are connected to multiple networks. Unfortunately, I have to run docker run --net mynet-1 -d --name alpine alpine and then docker network connect mynet-2 alpine for each container because the CLI doesn't support connecting a container to multiple networks at once.

It would be great if I could specify multiple networks at once in a single run command.

docker run --net mynet-1 --net mynet-2 -d --name alpine alpine

Would this be possible to implement? --net mynet-1,mynet-2 would also be an option. It probably would be enough if the CLI called the API for connecting the container to the second network, just as if network connect had been executed.

@felixb95 felixb95 changed the title Feature request for docker run: Ability to connect to multiple containers Feature request for docker run: Ability to connect to multiple networks Apr 20, 2020
@bka-dev
Copy link

bka-dev commented May 23, 2020

I would highly appreciate having such a feature included in Docker.

There is a use case I had yesterday, where I needed to set sysctl values for some network interfaces (e.g --sysctl net.ipv4.conf.eth1.rp_filter=0), however since eth1 did not exist after issuing the initial "docker run" command, I couldn't set this value for the particular interface ( And of course I wanted to avoid --privileged)

Were there any historic reasons or technical limitations why this feature wasn't included in the first place?

@david-l-riley
Copy link

This is partially fixed now. It is supported in the CLI, however this piece to make it work in the engine is not implemented yet: #1767 (comment)

@jakub-frajt
Copy link

Is there any progress to add support to define multiple networks directly via docker run? 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants