Reputation: 3727
I'm running Ubuntu as a subsystem on Windows 10.
I have just followed the steps to install Docker on Linux: https://docs.docker.com/install/linux/docker-ce/ubuntu/
And are now at the step to test the hello-world app:
$ sudo docker run hello-world
Where I get this error:
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
I have narrowed it down to that it actually is the service that is not running - despite lots of other solutions online that more or less fixes this type of error.
When I check the status:
$ sudo service docker status
* Docker is not running
It says it's not running so I start it successfully:
$ sudo service docker start
* Starting Docker: docker [ OK ]
If I check the status immediately it says it's running. But when I check it again a few second later, it's not runnning:
$ sudo service docker status
* Docker is running
$ sudo service docker status
* Docker is not running
Why is the Docker service stopping and how can I keep it running?
Upvotes: 6
Views: 7647
Reputation: 31584
What you got is as expected.
Microsoft does not support running the Docker daemon (also known as the service) within the WSL instance. You can refer to this discussion.
What you can do is just use docker client
in WSL to connect to a remote docker engine which means docker daemon
still on other PC.
But, if you use WSL2 which announced in May 6th, 2019
, then, from microsoft's announcement, it could be(There is also a demo in this announcement which you can have a look):
Today we’re unveiling the newest architecture for the Windows Subsystem for Linux: WSL 2! Changes in this new architecture will allow for: dramatic file system performance increases, and full system call compatibility, meaning you can run more Linux apps in WSL 2 such as Docker.
Upvotes: 4
Reputation: 184
You need either Docker on Windows: https://medium.com/@sebagomez/installing-the-docker-client-on-ubuntus-windows-subsystem-for-linux-612b392a44c4
Upvotes: 0