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

后端 未结 6 1237

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条回答
  •  -上瘾入骨i
    2020-11-22 06:07

    You expose ports using the EXPOSE keyword in the Dockerfile or the --expose flag to docker run. Exposing ports is a way of documenting which ports are used, but does not actually map or open any ports. Exposing ports is optional.

    Source: github commit

提交回复
热议问题