Install docker-ce in debian wsl and make it work with Windows Docker Desktop
- Install Windows Docker Desktop.
- Expose 2375 port on Docker settings.

For centos vm which running Docker service, add a file in /etc/docker/daemon.json
{
“hosts”: [
“tcp://0.0.0.0:2375”,
“unix:///var/run/docker.sock”
]
}
Now, if we restart docker service, it won’t work. Do the following:
Workaround by overriding the service configuration:
- Take a look at the current configuration:
# systemctl cat docker | grep Exec
ExecStart=/usr/bin/dockerd -H fd://
ExecReload=/bin/kill -s HUP $MAINPID
- Make an override:
root@imax:~# systemctl edit docker
In the editor, add the following lines:
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd
- Take a look at the new configuration:
root@imax:~# systemctl cat docker | grep Exec
ExecStart=/usr/bin/dockerd -H fd://
ExecReload=/bin/kill -s HUP $MAINPID
ExecStart=
ExecStart=/usr/bin/dockerd
Now, the docker
service can be started with a "hosts" section in daemon.json
.
So far, run systemctl start docker, all fine.
On linux docker host, we need to allow 2375 port.
sudo firewall-cmd — permanent — add-port=2375/tcp
3.Install docker in wsl debian version. Follow official instructions here.
https://docs.docker.com/v17.12/install/linux/docker-ce/debian/
4. Test it by typing this command:
docker -H tcp://0.0.0.0:2375 images
5. Add Docker host env into .bashrc or .profile in home directory.
echo “export DOCKER_HOST=‘tcp://0.0.0.0:2375’” >> ~/.bashrc