LOGBOOK

HELP

Quiz Entry - updated: 2026.12.01

On the default bridge network, which of these work from container alpine1: ping google.ch, ping alpine2, ping <IP of alpine2>? Why?

google.ch works and alpine2's IP works, but ping alpine2 by name fails: the default bridge has no DNS between containers.

Ping from alpine1 Result Reason
google.ch Works The container uses the host's DNS resolver, and outgoing traffic is NATed by iptables to the host's address.
alpine2 (name) Fails (bad address) The default bridge offers no name resolution between containers.
172.17.0.3 (alpine2's IP) Works Both containers sit on the same bridge (docker0), so plain IP traffic flows.

That is the main reason the default bridge is fine for quick development but should be avoided in production: containers can only find each other by IP, and IPs change whenever a container is recreated. A user-defined bridge (docker network create --driver=bridge meinebridge) fixes this, because Docker runs an embedded DNS server (at 127.0.0.11 inside each container) that resolves container names on such networks. (The legacy --link flag was the old workaround.)

The fix, step by step:

docker network create --driver=bridge meinebridge   # a user-defined bridge
docker run -itd --name alpine1 --network meinebridge alpine sh
docker run -itd --name alpine2 --network meinebridge alpine sh
docker exec alpine1 ping -c 2 alpine2               # now resolves by name

--driver=bridge is the default and could be left out; it only states that this is a bridge network, like the default one, but with Docker's DNS.

Inside the container, ip addr show lists only lo (127.0.0.1) and eth0 with the bridge address, for example 172.17.0.2.

Go deeper:

From Quiz: ISLAB / Docker Introduction | Updated: Dec 01, 2026