šŸ”Œ

Port Mapping

Exposing container ports to the host

Step 1 of 3

Why Port Mapping?

Containers have isolated networking. To access a web server inside a container from your browser, you need to map a host port to the container port.

bash
docker run -p 8080:80 nginx
# host:8080 → container:80
8080
Host
80
Container