Reputation: 31684
In the docs I noticed this: "You publish ports using the PUBLISH keyword in the Dockerfile".
Is this a bad idea? I have literally never seen a dockerfile with a PUBLISH directive, why isn't this used? And how do I use it in conjunction with -p or -P with docker run?
Upvotes: 2
Views: 623
Reputation: 74899
That documentation was incorrect and has been fixed. There is no PUBLISH
Dockerfile directive, it's a run time option only
-p, --publish list Publish a container's port(s) to the host
-P, --publish-all Publish all exposed ports to random ports
For the details of the two concepts see Difference between "expose" and "publish" in docker
Upvotes: 2