I am getting the following error when running a contaner by attaching to network interfaces test-net, sample-net,bridge0 . My requirement is to have a container that connects to different containers those are in different networks.
docker network create --driver bridge sample-net
docker container run --name c3 -d --network test-net alpine:latest ping 127.0.0.1
docker network create --driver bridge --subnet "10.1.0.0/16" test-net
docker container run --name c4 -d --network test-net alpine:latest ping 127.0.0.1
docker container run --name c1 -it --rm alpine:latest sh
docker container run --name c5 -d --network sample-net --network test-net --network docker0 alpine:latest ping 127.0.0.1
My intention is to connect "c5" with all other containers by connecting to their interfaces. However , I am facing the error while executing the command
docker container run --name c5 -d --network sample-net --network test-net --network docker0 alpine:latest ping 127.0.0.1
docker: Error response from daemon: Container cannot be connected to network endpoints: sample-net, test-net, docker0.
docker0
doesn't look like the name of something youdocker network create
here; does deleting that setting help? Do you have a specific reason to try to segregate these containers so much?docker run
with multiple--network
flags, but it doesn't work for me now and I can't find any evidence online that it was ever possible.