Docker Community Forums

Share and learn in the Docker community.

Give Two IP of the same network to a container

I am building a CI/CD for a CDN which is using anycast.
I would like to give two ip of the same docker network to an ubuntu 18.04 container.
For example I created this network:

docker network create -d bridge --subnet --gateway test_net

Now I connect my container to this network when I run it by adding --network test_net --ip
At this point my container have ip on eth0.

How can I give ip on eth1 for example on an ubuntu 18.04 container image ?
When I run docker network connect test_net my_container, I got an error because my container is already attached to this network. I also tried to give two --ip flag at the creation of the container but it doesn’t work too.

Moreover how can I add a loopback ip to my container ? for example lo:1 netmask

Thanks for your help