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 daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Is there any suggestion for solving this problem?
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:
See this script (from Matheus Marchini) to launch a docker-machine bash with the right setting:
Found the solution on this post: https://blog.jayway.com/2017/04/19/running-docker-on-bash-on-windows/
Running docker against an engine on a different machine is actually quite easy, as Docker can expose a TCP endpoint which the CLI can attach to.
This TCP endpoint is turned off by default; to activate it, right-click the Docker icon in your taskbar and choose Settings, and tick the box next to “Expose daemon on tcp://localhost:2375 without TLS”.
With that done, all we need to do is instruct the CLI under Bash to connect to the engine running under Windows instead of to the non-existing engine running under Bash, like this:
There are two ways to make this permanent – either add an alias for the above command or export an environment variable which instructs Docker where to find the host engine (NOTE: make sure to use single apostrophe's below):
Now, running docker commands from Bash works just like they’re supposed to.
Successful response: