Docker Community Forums

Share and learn in the Docker community.

Adding additional IP addresses to a container

(Jabberwookiee) #1

Good day all–

I’m a touch amazed that I can’t figure this out from the documentation or with the almighty web search. I have a device under test that acts as a proxy. I’ve figured out how to start it with a single IP address:

  • create a network (e.g. mynet and subnet –
  • use the run command to create a container on mynet with a specified address (e.g.

This all works trivially. However, I can’t figure out how to do two (related) things:

  • add another ip (e.g. to the same container.
  • even if I could, I can’t figure out how to do it prior to the entrypoint executing.

Ideally, I could do something like the following:

docker run --net mynet --ip --ip --name myproxy …

but I’ve tested that and you only start the container with the .3 on eth0. Likewise, I’ve tried using the
docker network connect command but I get an error that makes me think this isn’t possible:

Error response from daemon: endpoint with name mynet already exists in network mynet

Maybe I’m missing something fundamental by thinking that a container could service more than one IP address on a network.

Workaround: it occurred to me that I could do something egregious like have multiple networks (e.g. mynet1 and mynet2) that are defined like the following: and but that’s about as palatable as brussel sprouts.

If you’ve read this far, thx for the attention.