I\'m experimenting with Dockerfiles, and I think I understand most of the logic. However, I don\'t see the difference between \"exposing\" and \"publishing\" a port in this
Most people use docker compose with networks. The documentation states:
The Docker network feature supports creating networks without the need to expose ports within the network, for detailed information see the overview of this feature).
Which means that if you use networks for communication between containers you don't need to worry about exposing ports.