Interview Prep/Docker/Networking and Compose

Make a database reachable only by the app, and the app only through a reverse proxy, on a single host.

IntermediateScenarioNetworking and Compose
Answer

Situation read → Minimise published ports.

What I'd do → Publish only the proxy (80/443). DB and app have no ports: entries and sit on private networks. Verify:

docker compose ps --format '{{.Name}} {{.Ports}}'
ss -tlnp | grep docker-proxy

Why → Unpublished services are unreachable from outside the Docker networks.

Interview tip → Scan the host with nmap to confirm.

All Docker questions Roadmap: Docker & containers

More on Networking and Compose