Why is the Docker service stopping?

末鹿安然 提交于 2019-12-12 22:48:40

问题


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?


回答1:


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.




回答2:


You need either Docker on Windows: https://medium.com/@sebagomez/installing-the-docker-client-on-ubuntus-windows-subsystem-for-linux-612b392a44c4



来源:https://stackoverflow.com/questions/57267776/why-is-the-docker-service-stopping

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!