In the past with docker-machine I could run the following command to determine the IP address:
docker-machine ip default
This proved a convenient way to setup env vars within shell scripts so I could do things like run psql from host and access the postgres container being used by my app.
Disclaimer: I realize that docker.local is supposed to be a shortcut way to avoid using IP addresses with Docker for Mac, but for me it currently does not work when connected through VPN. I am sure that will be fixed eventually.
In the interim, and as part of my transition from docker-machine centric scripts, the question I would like guidance on is how do you get the IP address of xhyve docker instance?
Not sure if there is a specific reference point to go to, but read the docs on the beta getting started page, and it is mentioned near the bottom when verifying if Docker for Mac is running successfully.
Actually the section labelled: “Step 3. Explore the application and run examples”, there it mentions using the ping docker.local to confirm the Docker for Mac is working!!
Not sure how we changed the direction of this topic, but in answer to your question . . .
should I uninstall docker-machine, docker-compose from brew (homebrew) before I add symlinks ?
Yes, I uninstalled those components from homebrew before I installed Docker for Mac, and Docker for Mac put in the links in the correct places.
@hoshposh Moving forward we’ll be using localhost as the source of truth instead of docker.local
This should allow your running host scripts to use localhost without having to do the leg work of getting the IP.
Does that mean running multiple docker servers locally won’t be supported with Docker for Mac? That’s useful for local swarm testing and for testing new docker versions.
But what if you want an IP that is accessible by other containers from both a browser on the host side (Mac) and from for container to container communication on the Docker host side (xhyve/alpine). It isn’t clear now how to find the host ip of the xhyve VM.
I know containers should access each other by name (requires being on the same network) but it’s convenient to access by the published ip/port, and something like that is necessary if you’re trying to use a container (such as a build cache) from docker build.