OS X Firewall blocking external connections to NGinx Docker container

dockerfirewall

I have an Docker container running NGinx on a macOS High Sierra machine behind a corporate firewall that cannot be disabled. The container is unable to be accessed externally from other machines on the corporate network using the host IP. I have tried running the container on a machine not subject to the firewall and everything works fine, so the issue likely lies in the firewall.

Things I have tried:

Running

sudo /usr/libexec/ApplicationFirewall/socketfilterfw --add /Applications/Docker.app/Contents/MacOS/*
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --unblockapp /Applications/Docker.app/Contents/MacOS/*

and

sudo /usr/libexec/ApplicationFirewall/socketfilterfw --add /Applications/Docker.app/Contents/MacOS/Docker
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --unblockapp /Applications/Docker.app/Contents/MacOS/Docker

both commands add Docker to the list of apps under Security & Privacy > Firewall Options but the container is still not accessible remotely via the host IP.

Best Answer

This issue is likely nothing to do with your local machine.

If you are behind a corporate firewall, that firewall is designed specifically (amongst other things) to prevent exactly what you are trying to do: set up an externally accessible server on the internal (protected, corporate) LAN

The only way to be able to access your Mac at work (no matter what it is running) is to ask if your IT department will allow it.

Personally if someone asked for something similar where I work, I'd laugh in their face. A corporate intranet (depending on what your company does...) is no place for a personal server of any sort.

They already (likely) have a number of externally accessible servers (EG email, remote access, etc.) that they spend a lot of time on making sure they are secure and safe. It is unlikely they'll let you do this.

Additionally they may block setting up servers like this at the network level. Again contact your IT department and tell them what you are trying to do.