为何Docker服务停止? [英] Why is the Docker service stopping?

查看:674
本文介绍了为何Docker服务停止?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows 10上将Ubuntu作为子系统运行。

I'm running Ubuntu as a subsystem on Windows 10.

我刚刚按照以下步骤在Linux上安装Docker:
https://docs.docker.com/install/linux/docker-ce/ubuntu/

I have just followed the steps to install Docker on Linux: https://docs.docker.com/install/linux/docker-ce/ubuntu/

现在正在测试Hello World应用程序:

And are now at the step to test the hello-world app:

$ sudo docker run hello-world

在哪里出现此错误:

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.

当我检查状态时:

$ 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

为什么Docker服务停止,我如何使其继续运行?

Why is the Docker service stopping and how can I keep it running?

推荐答案

您得到的是预期的结果。

What you got is as expected.

Microsoft不支持在WSL实例中运行Docker守护程序(也称为服务)。您可以参考此讨论

Microsoft does not support running the Docker daemon (also known as the service) within the WSL instance. You can refer to this discussion.

您可以做的就是在WSL中使用 docker client 连接到远程docker引擎,这意味着 docker daemon 仍在其他PC上。

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.

但是,如果您使用< a href = https://devblogs.microsoft.com/commandline/announcing-wsl-2/ rel = nofollow noreferrer> WSL2 ,它于 2019年5月6日宣布,则可能是从Microsoft的公告中得出的(此公告中还有一个演示,您可以看一下):

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):


今天,我们将发布用于Linux的Windows子系统的最新体系结构:WSL 2!这种新架构的变化将允许:大幅提高文件系统性能,以及完全的系统调用兼容性,这意味着您可以在WSL 2中运行更多Linux应用程序,例如Docker。

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.

这篇关于为何Docker服务停止?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆