Setup Remote Host on Docker-Desktop Windows

Hi,

I am quite new to docker and could need a little bit of guidance.

I have read quite some articles about running a remote host, however I don’t really get how to achieve what I want since those articles all have very different approaches or prerequisites (e.g. dockerd which I cannot find on my windows pc, editing hostconfig.json, which I cannot either find, neither in the windows file system nor in the WSL file system). I think most of those articles simply assume that the docker host (daemon) is running on a linux machine.

Basically, I run Docker Desktop on my Windows 10 Desktop PC, which I want to use as my server running a linux docker cointainer (in which I want to develop/run server apps). Then I want to be able to connect from my Macbook to the remote docker host on windows to work and develop in that linux Docker container.

I have tried:

I added a rule to the Windows 10 firewall:

netsh advfirewall firewall add rule name="docker engine" dir=in action=allow protocol=TCP localport=2375
  1. what is the best way to expose the port of the Docker Machine on my remote host?

1a) use EXPOSE in Dockerfile, then build a new image/container ? Is adding one line just enough?

EXPOSE 2375

1b) use /etc/systemd/system/docker.service.d/options.conf which some articles say to setup like:

[Service]
ExecStart=/usr/bin/dockerd -H unix:// -H tcp://0.0.0.0:2375

then restart the daemon

# Reload the systemd daemon.
sudo systemctl daemon-reload

# Restart Docker.
sudo systemctl restart docker

However, on my WSL I seem not be able to do that.

1c) running the dockerd like this does not work either:

sudo dockerd -H unix:///var/run/docker.sock -H tcp://0.0.0.0:2375

I did find some json files in C:\Users<user>.docker: config.json and daemon.json. Could I use those to expose the docker? If so, how?

This is just all very confusing to me.

Thanks for any tips!

1 Like