Closed
Description
At the moment if you connect a container to multiple user defined networks then the default route used will be the subnet of the last connected network. Is there any way to avoid the order which the container is added to the networks determining which default route is used ? Something like docker network connect backend rose --no-default-route
In the below example, a way to avoid adding the backend network to the container and it automatically becoming the default gw. It would be nice to have the behavior user definable.
docker network create frontend
docker network create backend
docker run -d --name rose --net=frontend busybox top
docker exec rose ip r
default via 172.20.0.1 dev eth0
172.20.0.0/16 dev eth0 src 172.20.0.2
docker network connect backend rose
docker exec rose ip r
default via 172.21.0.1 dev eth1
172.20.0.0/16 dev eth0 src 172.20.0.2
172.21.0.0/16 dev eth1 src 172.21.0.2