I'll go on to the difference between exposing and publishing ports, why they are used and how to use them. In this tutorial, I'll discuss dealing with ports in Docker. This internal and external communication is handled with exposed and published ports in Docker respectively. In the same setup, some containers also interact with the outside world.
In a multi-container setup, the services running in the containers communicate with each other over a common network.