Docker Community Forums

Share and learn in the Docker community.

Programatically determine if Docker for Mac Beta is installed?


(Mkobit) #1

I work with other members on my team who do not have Docker for Mac Beta yet. There are scripts that need to determine the IP of the running containers. There is some weirdness to it now around how it gets done (basically spinning up and getting info from docker-machine and other not-so-goodies).

Is there is a simple way to programmatically determine if Docker for Mac Beta is installed? I thought maybe just checking for pinata, but pinata no longer seems to be on my PATH.

Expected behavior

Actual behavior

Information

  • host distribution and version ( OSX 10.10.x, OSX 10.11.x, Windows, etc ) - 10.10.5
  • Docker version - Version 1.11.2-beta15 (build: 9168) 603884f1679ff0528724854e9d27fc8e67fdfd8f

Steps to reproduce the behavior


(David Maze) #2

You could parse $DOCKER_HOST, if it exists. If it does, then containers’ docker run -p ports are probably on the same host as the Docker daemon; if it doesn’t, then those published ports are probably on 127.0.0.1.

(This doesn’t solve the problem of containers talking to each other: on Docker for Linux, and under docker-machine, it’s generally enough to find the bridge IP 172.17.0.1 or 192.168.99.100 and point both the host and other containers at that address, but this doesn’t really work on the current Mac beta.)