Hands-on task
Segmentation: the storefront can't see the database
An application of three izzylab/minihttp:1 containers: web calls api (UPSTREAM=api:8080), api calls db (UPSTREAM=db:8080). Right now all three are in one network flat, and from web you can get straight to the database — an audit won't let that pass.
Split the network:
- network
front:webandapi; - network
back:apianddb; webonly infront,dbonly inback,apiin both;- the chain
web → api → dbworks, and fromwebyou can't reachdbeither by name or by IP.
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
- network segmentation
- multi-network container