I am able to install docker, docker-compose and docker-machine
However when I try to run
root@DESKTOP-51NFMIM:~# docker ps
Cannot connect to the Docker d
Note: if you are using the Ubuntu from WSL (Windows Subsystem for Linux), do understand that the docker client is working, not the docker server (daemon).
See Microsoft/WSL issue 2114 and this thread.
For the server, you would still need to use only Docker for Windows and its Hyper-V VM.
Then, Microsoft/WSL issue 2102 adds:
I was able to make TLS work from inside WSL by changing
DOCKER_CERT_PATH
environment variable (which I got from runningeval $(docker-machine.exe env --shell bash)
) from "C:\C:\Users\mmarchini\.docker\machine\machines\default
" to "/mnt/c/Users/mmarchini/.docker/machine/machines/default/
" .
At least docker build seems to be working now, I'll try usingdocker-compose
later.
See this script (from Matheus Marchini) to launch a docker-machine bash with the right setting:
#!/usr/bin/env python3
from subprocess import run, PIPE
completed_process = run(["docker-machine.exe", "env", "--shell", "bash"], stdout=PIPE)
docker_env = completed_process.stdout.decode("ascii")
for line in docker_env.split("\n"):
if "DOCKER_CERT_PATH" in line:
env_var, path, _ = line.split('"')
path = path.replace("\\", "/")
drive, path = path.split(":", 1)
path = "/mnt/{}{}".format(drive.lower(), path)
line = '{}"{}"'.format(env_var, path)
print(line)