Make Docker to listen on Mac on tcp port

I am trying to get docker-java ( https://github.com/docker-java/docker-java ) to work with Docker for mac ( https://docs.docker.com/docker-for-mac/ ).

How can I set the equivalent:

DOCKER_OPTS="-H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock"

On the Mac version of Docker?

+5
source share
2 answers

If you are using the latest docker for mac beta, as per issue 25064 :

~/Library/Containers/com.docker.docker/Data/database/com.docker.driver.amd64-linux is a git database.

Note: if ~/Library/Containers/com.docker.docker/Data/database/ does not contain com.docker.driver.amd64-linux , go to this database/ folder and do git reset --hard .

The daemon configuration is under etc/docker/daemon.json , which simply uses the configuration from the Linux configuration file .

You need to change the configuration, and then do a git commit : docker should automatically reboot at that point (if not, restart) with the new configuration.


As OP Michael Nelson mentioned in the comments and described in detail in the Docker for Windows section "(which has sections related to" Docker for Mac ")

VM (Alpine-based) uses OpenRC as its init system .

The init script docker relies on the /usr/bin/mobyconfig script.
For this, the mobyconfig script requires the kernel to be loaded using the com.docker.database label, which determines the location of the configuration file or instructs.

mobyconfig script can get the network and insecure-registry configuration for the Docker daemon, or select the configuration file from /etc/docker/daemon.json .

+3
source

There is a related answer that offers a workaround using socat .

This really works to open port 2375 on the network:

 socat TCP-LISTEN:2375,reuseaddr,fork UNIX-CONNECT:/var/run/docker.sock 

Link: Docker Access Daemon Remote api on Docker for Mac

+2
source

All Articles