What is the difference between “expose” and “publish” in Docker?

后端 未结 6 1230

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

6条回答
  •  情深已故
    2020-11-22 06:10

    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.

提交回复
热议问题