Access to a Docker for OSX Host from a container

Setting network as host is not quite enough for this case.
The working solution is here (according to https://forums.docker.com/t/access-host-not-vm-from-inside-container/11747/10):

sudo ifconfig lo0 alias 172.16.123.1  
docker run -it --rm busybox ping 172.16.123.1  

The trick is to give the host's lo0 interface a new IP which can be accessed from the container.

Konpat Preechakul

Read more posts by this author.