Expected behavior
I should have a way to access host machine from within container.
Docker Compose Mac Localhost
Actual behavior
Docker Compose Linux Mint
Cant figure out how to do that with docker for mac beta
- Docker compose also has the same commands as docker so docker-compose -name setup1 exec webserver dosomecommand best part is, if you want to change db's or something like that for unit test you can include an additional.yml file to the up command and it will overwrite any items with similar names, I think of it as a key=value replacement.
- 1-Make sure your docker-compose version is at least 3.2 and in my case. As of Docker 3 on OSX, I had to disable Experimental Feature gRPC and restart as per.
- May 31, 2016 Building on @mikehaertl’s response, on OSX, I was able to add an alias for my loopback adapter: sudo ifconfig lo0 alias 172.16.222.111. Then in docker run, I used:-add-host my.private.dnsname.com:172.16.222.111. This workaround enables docker-to-localhost connectivity on OSX’s docker as of 17.06.
Information
1-Make sure your docker-compose version is at least 3.2 and in my case. As of Docker 3 on OSX, I had to disable Experimental Feature gRPC and restart as per. Sickcodes/docker-osx:latest - I want to try it out. Sickcodes/docker-osx:latest - I want to use Docker-OSX to develop/secure Apps in Xcode (sign into Xcode, Transporter) sickcodes/docker-osx:naked - I want to use Docker-OSX in CI/CD (sign into Xcode, Transporter) Create your personal image using:latest. And then pull your image out.
With the change to all the docker images running on localhost and the ditching of virtualbox (which from what little I understand, made networking more difficult), I would think there would be a standard way to access the host machine from within the docker container. Is there a way to do this with docker for mac? All the docs regarding doing so seem to only be relevant to the virtual box version and docker-machine