[docker][osx] Access from container to host

docker run has a networking configuration you can specify. If you pass: --network=host the container will use the host network stack.

It doesn’t work on OSX. Whell, it actually does work, but you can’t really use it. Docker deamon on osx runs on a virtual machine, so passing --network=host use the VM network.

The simplest workaround I found is released in version 17.06 of docker-for-mac. Just use docker.for.mac.localhost as the host name.


Written on January 8, 2018
[ docker,  osx,  ]