Hands-on task
docker compose: project networks
/root/shop holds the compose project shop of three services on izzylab/minihttp:1: web → api → db. It's running, but all three services sit in the project's one default network, and the storefront can't be opened from the server.
Rewrite /root/shop/compose.yaml and bring the project up again (docker compose in /root/shop):
- two project networks:
frontandback; webonly infront,dbonly inback,apiin both;webis published on the server's127.0.0.1:8080(the service's port is 8080);- services call each other by service name, and
dbcan't be reached fromweb.
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 compose
- compose networks
- ports