Docker Community Forums

Share and learn in the Docker community.

Clarify Network features in documentation for Docker for Mac


(Gsavan) #1

Hello!!

It seems that Network features for Docker for Mac need to be clarified bit further.

What is the difference between following two sentences?

  • Port forwarding works for localhost; --publish, -p, or -P all work.
  • Docker for Mac can’t route traffic to containers.

Source: https://docs.docker.com/docker-for-mac/networking/

Thanks
Savankumar


(Don McCullough) #2

Docker for Mac creates a virtual machine for your containers to run on in the background. The Mac itself can see the port on Localhost and if your Mac has the firewall turned off you can browse to your Mac’s IP and port number just fine. I just verified here Turn on Mac firewall it fails to display NGINX default page turn the firewall off and it works from another pc on the same network. you may be able to set the firewall to allow docker to have incoming connections but I would not guarantee that will work. I have no more time to play right now LOL


(Don McCullough) #3

based on this command: docker run -p 80:80 -d nginx