Easy way to get VM IP?

Expected behavior

I see the bridge100 device in ifconfig but it would be nice to have a way to grab it via the pinata tool. Are there plans to add this?

Actual behavior

I can’t seem to find an easy way to extract the IP address of the Docker VM?

Information

  • pinata diagnose -u on OSX

OS X: version 10.11.3 (build: 15D21)
Docker.app: version v1.11.0-beta6
Running diagnostic tests:
[OK] docker-cli
[OK] Moby booted
[OK] driver.amd64-linux
[OK] vmnetd
[OK] osxfs
[OK] db
[OK] slirp
[OK] menubar
[OK] environment
[OK] Docker
[OK] VT-x
Docker logs are being collected into /tmp/20160405-184220.tar.gz.
Your unique id in bugsnag is: 3ACAD635-A9EF-4562-AD2B-60F77678720A
Please quote this in all correspondence.

1 Like

I would like this as well along with a method to check if a machine is running with the ability to utilize the new local dev environment vs not. Is there a variable in the ‘docker info’ I can count on for that?

That’s really a necessary feature as I usually use dnsmasq in combination with jwilder/nginx-proxy to run multiple web containers with local dev domains.
And I need to be able to automatically start dnsmasq with the IP of the VM.

2 Likes

especially since 192.168.64.1 is the address of the bridge and not the VM that’s behind docker.local

Unless you are using the VPN mode, the address can be found by looking up docker.local, or by running any container with an exposed port and looking at the IP shown on docker port, or by using a host net namespace container to print it eg docker run --net=host alpine ifconfig eth0.

We are not providing an interface to get this though as we are looking into making changes here.

2 Likes

I was hoping there would be an easy way to automate, I guess I will wait for now until things get a bit further along.

I’ve been doing this in the interim:

export DOCKER_VM_IP=`ping -q -c 1 docker.local | sed -En "s/^.*\((.+)\).*$/\1/p"`
1 Like

I use a very general Docker run to find out about the host:

docker run --rm --net host alpine ip address

ah, same thing @justincormack suggested.

the nice thing is that any scripts you write will work on any Docker daemon, not just a pinata based one.

1 Like

I just want to point out that 1.11.0-beta8 now supports docker.local even when you’re in VPN mode. Plus my VM’s IP seems reasonably stable each time I startup/shutdown. So progress made, yay!

Camerons-iMac:vscode cameron$ ip=`ifconfig bridge100 | grep inet | awk '$1=="inet" {print $2}'`
Camerons-iMac:vscode cameron$ echo $ip
192.168.64.1