edst
(Edst)
February 12, 2018, 9:35pm
1
It seems to be a known issue that if one’s running a Docker container exposing a privileged port (e.g. port 80) and has the macOS application firewall turned on, then the container cannot be accessed by other machines on the LAN.
Expected behavior
I should be able to connect to a docker container bound to a privileged ports (<1024) from the local network (i.e. not from the host machine).
Actual behavior
Connection to privileged ports (<1024) from outside the host time out.
Steps to Reproduce
On my local machine (192.168.1.2) I create a container running on port 80:
docker run -p 80:80 -d --cap-add NET_BIND_SERVICE nginx
I can access this container through localhost:
$ curl --head --write-out '%{http_code}\n' localho…
opened 03:10PM - 21 Jul 16 UTC
If I have the OS X firewall on and try to run, say, nginx on port 80, the port i… s not opened for external clients. If I run the same image opening 8080 it is fine. I have tried adding an exception for docker in System Preferences to no avail. If the firewall is off, privileged ports are accessible externally.
Does anyone have any solutions to this without that don’t involve disabling the firewall?
I have tried adding vpnkit and Docker (Applications/Docker.app/Contents/MacOS/Docker) to the application firewall using socketfilterfw --add … . and socketfilterfw --unblockapp … . with no avail.
macOS version: 10.13.2
Docker for Mac version: 17.12.0-ce-mac49 (21995)
2 Likes
lephleg
(Lephleg)
April 10, 2018, 12:34pm
2
@edst did you find a workaround on this?
I’m also interested on how to allow incoming connections on port 80 using the native MacOS firewall.
OS Version/build: MacOS High Sierra 10.13.3 (17D102)
Docker for Mac version: Docker version 18.03.0-ce, build 0520e24
edst
(Edst)
April 10, 2018, 8:35pm
3
I finally found a solution a few days back. It involves permitting the com.docker.vmnetd process through the application firewall:
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --add /Library/PrivilegedHelperTools/com.docker.vmnetd;
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --unblockapp /Library/PrivilegedHelperTools/com.docker.vmnetd;
2 Likes
joha0033
(Joha0033)
August 30, 2018, 7:33pm
4
I’m having the same probelm and tried this solution without a fix…
What is the output supposed to be for these commands?
➜ ~ /usr/libexec/ApplicationFirewall/socketfilterfw --add /Library/PrivilegedHelperTools/com.docker.vmnetd
Application at path ( /Library/PrivilegedHelperTools/com.docker.vmnetd ) added to firewall
➜ ~ /usr/libexec/ApplicationFirewall/socketfilterfw --unblockapp /Library/PrivilegedHelperTools/com.docker.vmnetd
The application is not part of the firewall
STILL getting the same results… any ideas?
docker run -d -p 80:80 --name webserver nginx <-- this says connection refused in the browser
on macOS high sierra 10.13.6
docker version 18.06.1 - ce