Docker for mac 10.10

broken image
broken image
broken image

If not (which means docker host is either windows or linux, not Mac), use the ip r | grep ^default | cut -d' ' -f3 approach and add to /etc/hosts too. I would like to write a universal shell script which will first try to resolve and add the resolved address to /etc/hosts. That's why there is a feature in Docker for Mac - special hostname with which you can access your host Mac from container.

broken image

Will give a wrong answer 172.17.0.1 if Docker host machine is Mac (You won't be able actually to access your Mac from container with 172.17.0.1). In order to access docker host machine I would like to use the same approach but it does not work for Mac atm. Grep dockerhost /etc/hosts || echo $(ip r | grep ^default | cut -d' ' -f3) dockerhost > /etc/hosts There is no common solution for all platforms atm. There was an issue on github with lot's of comments where people were asking to make unified way to access host ip. You will probably advice me to put the service I want to access in another docker container too but for fastest tests on CI I want to access docker host machine by ip from container, that's why I need it. I want to write a universal shell-script which will add a proper IP address of docker host machine to /etc/hosts inside of container.