A web server can run inside a container while your browser runs on the host. Port publishing connects a host port to a container port so you can reach the server. The server must still be running: a container exits when its application process ends. section 2.4
Publish a web server
Run `docker container run --detach --publish 8088:80 diamol/ch02-hello-diamol-web:2e`. The mapping sends traffic arriving at host port 8088 to port 80 in the container. `--detach` leaves the web server running in the background. Check `docker container ls`: its PORTS column shows `0.0.0.0:8088->80/tcp`. section 2.4
In a Compose file, the same choice goes under a service’s `ports` property. `"8010:80"` selects host port 8010 for container port 80; `"80"` publishes container port 80 on a random host port. Services that do not need a published port can omit the property. section 7.2
Publishing every application port is not always the right arrangement. With a reverse proxy, only the proxy has published ports. It receives incoming requests and fetches responses from application containers, which remain internal components. section 20.1
