1

I am running Ubuntu 18.04 on Windows 10 pro. I have installed docker on Ubuntu. I can see version of docker on the Ubuntu, but I am not able to run hello-world test container of docker on the system. Whenever I type command "sudo service docker start" it shows me "*Starting Docker:docker" but when I check the status of the service it shows me "*Docker is not running" Or sometimes "*Docker is running" but in the next status check after few seconds it shows "*Docker is not running"

Also gives an following error whenever tried to run test container(using command docker run hello-world ) provided by Docker.

"Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?"

Please find the attached screenshot for more information enter image description here

Rahul Raut
  • 623
  • 6
  • 21
  • 2
    Cause: absence of cgroups, /var/run, unix socket and many more. For workaround run `wsl.exe` as admin, then start dockerd. Though it will not run with `--host unix://` and `--host tcp://`. – Biswapriyo Mar 13 '19 at 05:10

1 Answers1

0

To run docker on Window'subsystem for Ubuntu, it's necessary to install docker on Windows machine as well. Because Docker client running on Linux (WSL) sending commands to your Docker Engine daemon installed on Windows. To tell Ubuntu's Docker where the Docker host is running, following command is used. -H is for host.

docker -H localhost:2375 images  

Also need to update a setting in "Windows Docker settings' panel". Please refer following screenshot for more information enter image description here

To not type above command every-time, we can add following entry in .bashrc file

 export DOCKER\_HOST=localhost:2375

This answer is short hand of following blog - installing the docker client on windows subsystem for Linux Ubuntu

Rahul Raut
  • 623
  • 6
  • 21
  • Your question and answer don't match. In question, you're running docker daemon `/usr/bin/dockerd` but in answer, you're running docker daemon in Windows. – Biswapriyo Mar 13 '19 at 13:32
  • @Biswapriyo In question I have tried to explain everything with os versions and screenshots. I have also tagged this question in Windows subsystem for Linux. – Rahul Raut Mar 13 '19 at 13:39