Homelab Academy / Modules
Orient, prior check, guided practice, required Feynman, reflect.
Module: Compose Operations & IaC
Activity type: Lesson (Orient → Recall → Learn → Explain → Reflect)
Learning objective: Explain the difference between a container port and a host-published port
Bloom level: Understand / Apply
Last reviewed: 2025-03-08
Explain the difference between a container port and a host-published port
Teach how Docker Compose creates isolated bridge networks, provides service-name DNS, connects multi-homed services, and controls host exposure through explicit port publishing.
Complete the module reading first:
Explain the lab to someone who knows basic networking but has never used Docker.
Each container is like a small machine with one or more virtual network cards. The frontend network connects the client to the gateway, and the backend network connects the gateway to the database. Docker supplies a private directory service so containers on a shared network can use names such as gateway and database instead of changing IP addresses. The client cannot directly find or contact database because they do not share a network. The gateway has a virtual connection to both networks, so it can talk to each side. Port 8080 is open inside the gateway container, but it is not mapped to a port on the physical host. Therefore, other containers on frontend can use it, while host users do not receive a Docker-published endpoint.
Answers save in this browser (localStorage). Completing all five fields is part of the mastery unlock.