Docker Community Forums

Share and learn in the Docker community.

Remote API with Docker for Mac (BETA)

beta

(Peter Liljenberg) #1

Is the Remote API available on Docker for Mac?
With docker-machne and regular linux docker versions I can access the API using localhost:2375/2376.
This doesn’t seem to work on Docker for Mac?


(Peter Liljenberg) #2

Workaround - using ‘socat’:

$ socat -d TCP-LISTEN:2376,range=127.0.0.1/32,reuseaddr,fork UNIX:/var/run/docker.sock

$ curl localhost:2376/version
{"Version":"1.11.2","ApiVersion":"1.23","GitCommit":"56888bf","GoVersion":"go1.5.4","Os":"linux","Arch":"amd64","KernelVersion":"4.4.12-moby","BuildTime":"2016-06-06T23:57:32.306881674+00:00"}


(Alexandre) #3

That’s a cool hack!

Thanks for sharing


(Mikhail Stepura) #4

You can even run socat in the Docker for Mac itself
docker run -d -v /var/run/docker.sock:/var/run/docker.sock -p 2376:2375 bobrik/socat TCP4-LISTEN:2375,fork,reuseaddr UNIX-CONNECT:/var/run/docker.sock


(Andrii Parfonov) #5

Does anyone know other ways that do not require installation of such utilities as socat?


(Llitfkitfk) #6

Try this:
docker run -p 3375:2375 -v /var/run/docker.sock:/var/run/docker.sock -d -e PORT=2375 shipyard/docker-proxy


(Marcel Trautwein) #7

the question is: is this just a “missing beta feature” or is it “missing by design”?
I hope not to find more workarounds in the near future but port 2375 being exported per default :slight_smile:

P.S: found this thread [worked around] Docker HTTP(S) API no longer available in beta9? via https://github.com/bmuschko/gradle-docker-plugin/issues/235 and related docker-java issues that read like “we won’t fix that, use the damn socket” :frowning:

P.S: the #known-issues do list this “solutions” too: