In this docker quesiton it says docker publishes the exposed port on all the nework intefaces on the host. Is it true. My understading is that it will only do so when we explicatly set the --publish-all or --publish flag. I am bit confused
No, per the docker docs, it’s indeed published by default on all interfaces, which say:
Important
When a port is published, it’s published to all network interfaces by default. This means any traffic that reaches your machine can access the published application. Be mindful of publishing databases or any sensitive information. Learn more about published ports here.
Its still contradictory, the question says unless specified otherwise meaning we if we dont put -P or p it does nto publish the ports outside
As per doc kerdocs if you put a EXPOSE statment in your dockerfile and you dont explicity pulish the port by default those ports are not published. That is the default. May be I am confused by the way the question is worded, there is no context and it ask
Unless specified the port is pulished to all network interface is FALSE. I will leave it at that.