If you cannot use Docker Desktop you still can use docker in Windows via Linux and WSL2.
How to:
- install WSL2,
- install Ubuntu 22.04,
- install docker.io in Ubuntu,
- allow docker remote connection,
- install Docker CLI in windows,
- specify DOCKER_HOST.
As a result, you get docker
command working in WSL2 and in Windows.
Install Docker
sudo apt update
sudo apt install docker.io
Allow running docker
command w/o root
sudo groupadd docker
sudo usermod -aG docker $USER
<reboot> or newgrp docker
Allow docker remote connections
Edit the file /etc/systemd/system/docker.service.d/override.conf
by calling the command
systemctl edit docker
Change content to:
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H fd:// --containerd=/run/containerd/containerd.sock
Reload systemd and restart docker
systemctl daemon-reload
systemctl restart docker
Check that port is being listen
netstat -lntp | grep 2375
If not, check the docker logs
journalctl -xeu docker.service
In Windows install docker cli
winget install Docker.DockerCLI
Set environment variable
$env:DOCKER_HOST="tcp://localhost:2375"
You might get docker-credential-wincred
not found error during the build.
Similar issue is discussed here https://github.com/docker/docker-credential-helpers/issues/24
Edit the ~/.docker/config.json
file to remove the credsStore
param.
Top comments (0)