Hands-on task
Containers can't find each other by name
Two containers from izzylab/minihttp:1 run in Docker's default network: api and web, which has UPSTREAM=api:8080. But web can't reach api: docker exec web wget -qO- http://127.0.0.1:8080/call returns an error, and docker exec web wget -qO- http://api:8080/ says the address can't be resolved.
Create your own network shop (driver bridge) and connect both containers to it so that web finds api by name. You don't have to recreate the containers.
The lab has its own Docker with no internet access; the images are already loaded: izzylab/minihttp:1, alpine:3.21, busybox:1.36, nginx:1.27-alpine. izzylab/minihttp is a tiny HTTP service on port 8080: GET / answers <NAME> ok, GET /call itself goes to http://<UPSTREAM>/ and answers <NAME> -> <the neighbor's reply> (or 502), GET /env shows its settings. It is configured with the environment variables NAME, PORT, BIND (the address it listens on) and UPSTREAM.
- docker network
- bridge
- docker dns