How to reach MacOSX from Container?


I would like to use a docker container to run NodeJS Stack (node, grunt, npm, bower, hell…).
Docker is perfect for that. Therefore the SPA into container need to speak with the backend installed on MacOS (not into a container because dev mode). So how can i contact the local host ?

Thanks a lot.
Best regards,

The Mac’s localhost ( IP is translated to something inside the container. I think this varies from one system to the next, so you need to find out:
cat ~/Library/Containers/com.docker.docker/Data/database/com.docker.driver.amd64-linux/slirp/host

This means you can get to the Mac’s from inside the container via

I know of 2 options:

  • Pass in the host IP to the container as an environment variable so it knows about the IP.

  • Or have the container point to a known static IP (like Then alias the host to that IP.

      ifconfig lo0 alias