Docker port mapping (-p) Explained

What Docker port mapping (-p) does, with an example.

Published November 10, 2026

Docker port mapping (-p) exposes a container's internal port to the host machine, in the format host_port:container_port.

Key points

  • Part of the standard Docker CLI used for building, running, and managing containers

Example

docker run -p 3000:3000 myapp
More General articles