Skip to content
Theory · Networks · lesson 4 of 6

Published and internal ports

The shop has two containers on the shop network: the web site and the db database. Shoppers must reach the site but must not see the database: only the shop's code talks to it. These are two different paths: between containers inside the network and from the host outside. Docker opens them with different mechanisms.

In this lesson

  • Inside a network, a port is open to neighbors
  • Outside, only the published port
  • EXPOSE publishes nothing
  • Common mistake
  • Key points