Docker desktop for Mac: bind to tcp port

1.7k Views Asked by At

I'm running ShinyProxy (https://www.shinyproxy.io/) locally on my mac, together with Docker Desktop for Mac.

ShinyProxy requires access to the Docker daemon via tcp, rather than just via unix socket.

Just to be clear, Docker desktop binds by default to unix:///var/run/docker.sock. I need it to bind to http://127.0.0.1:2375.

I can't seem to find a way to make Docker desktop bind to a tcp port. Has anyone solved this problem before?

1

There are 1 best solutions below

0
On

Ok, from what I could find, Docker Desktop for Mac does not bind to TCP by choice (I guess for obvious security reasons). And there is no way to change that. So the workaround I found is the following:

socat TCP-LISTEN:2375,range=127.0.0.1/32,reuseaddr,fork UNIX-CLIENT:/var/run/docker.sock

It basically reroutes the Unix socket to a tcp port (binding on localhost only). This allowed me to access the Docker daemon via TCP.