Skip to content

Instantly share code, notes, and snippets.

@ThinhPhan
Created August 16, 2019 16:32
Show Gist options
  • Save ThinhPhan/9c57ef3d2717d499507aeb2bed8a65c4 to your computer and use it in GitHub Desktop.
Save ThinhPhan/9c57ef3d2717d499507aeb2bed8a65c4 to your computer and use it in GitHub Desktop.
Docker expose vs ports

ports

  1. Activates the container to listen for specified port(s) from the world outside of the docker(can be same host machine or a different machine) AND also accessible world inside docker.
  2. More than one port can be specified (that's is why ports not port)

docker port

expose

  1. Activates container to listen for a specific port only from the world inside of docker AND not accessible world outside of the docker.
  2. More than one port can be specified

docker expose

Links (for review later) What is the difference between docker-compose ports vs expose

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment