📦Container Port Mapping
Also known as Port Publishing, Docker Port Mapping, Publish Port, docker run -p
A link from a host port to a port inside a box. It lets outside traffic in.
Think of it like
Think of it like a phone switchboard. A call to one number is passed to a desk inside.
Example
Jack runs two web apps, each listening on port 80 inside its container. He maps one to host port 8080 and the other to 8081.
Why it matters
Without it, nothing outside the container can reach the app. It is the first thing to check when a page will not load.
Definition
Example code
console
$ docker run -d -p 8080:80 nginx
$ curl -I localhost:8080
HTTP/1.1 200 OK