Network - container mode combined with bridge mode

docker network create --driver bridge alpine-net
docker run -dit --name alpine1 --network alpine-net alpine ash
docker run -dit --name alpine2 --network alpine-net alpine ash
docker run -dit --name alpine3 --network container:alpine2 alpine ash

My question is when I get into the container alpine1. Then, I ping the ip address of container alpine2 ( How could the Docker daemon know whether I want to go to alpine2 or alpine3?

Aren’t both the container alpine2 and alpine3 share the same ip address ( How could Docker daemon know which one to route the traffic to?

docker exec -it alpine1 /bin/sh
/ # ping
PING ( 56 data bytes
64 bytes from seq=0 ttl=64 time=0.075 ms
64 bytes from seq=1 ttl=64 time=0.114 ms
64 bytes from seq=2 ttl=64 time=0.103 ms

Hi :slight_smile:

No, all containers still have individual ips.

If you want to share a service, look into “docker service”
this way multiple containers can share load.