Sunday 23 February 2020

What exposing a port in Docker does, and doesn't do

I was unsure what exposing a port in Docker does. Since you can also publish a port, I wondered what the difference between exposing and publishing is.Should I use expose to allow two containers to talk to each other?Does it make a container accessible from the outside world?The information I could find online wasn't very accurate. There's a highly-upvoted and accepted answer on Stack Overflow that's partly incorrect. And in the official docs, there's an outdated section so filed a PR to update it.I wrote this article to save someone else the time and confusion I had to go through:https://maximorlov.com/exposing-a-port-in-docker-what-does-it-do/.Hope you find it useful. Have a nice Sunday!

Submitted February 23, 2020 at 01:41PM by _maximization

No comments:

Post a Comment