Docker - Networking - Exposing and Publishing Ports

Publish a container port to the host

docker run -d -p 8080:80 my-image

NOTE:

  • Exposing Ports - Makes a port available to linked containers.
  • Publishing Ports - Maps a container port to a host port, making it accessible externally.