windows - 为什么 Docker 服务停止?

标签 windows docker ubuntu windows-subsystem-for-linux

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

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

现在正在测试 hello-world 应用程序的步骤:

$ sudo docker run hello-world

我在哪里得到这个错误:
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.

我已将其范围缩小到它实际上是未运行的服务 - 尽管有许多其他在线解决方案或多或少地修复了此类错误。

当我检查状态时:
$ sudo service docker status
* Docker is not running

它说它没有运行,所以我成功启动它:
$ sudo service docker start
* Starting Docker: docker                                                                                       [ OK ]

如果我立即检查状态,它会说它正在运行。但是当我几秒钟后再次检查时,它没有运行:
$ sudo service docker status
* Docker is running

$ sudo service docker status
* Docker is not running

为什么 Docker 服务停止,我怎样才能让它继续运行?

最佳答案

你得到的和预期的一样。

Microsoft 不支持在 WSL 实例中运行 Docker 守护程序(也称为服务)。您可以引用this discussion .

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

但是,如果您使用 WSL2May 6th, 2019 中宣布,那么,从微软的公告来看,可能是(这个公告里还有一个demo,大家可以看看):

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.

关于windows - 为什么 Docker 服务停止?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57267776/

相关文章:

python - 在 Cygwin 上安装 Python 3.0

恢复后的MySQL二进制日志

java - 在 Windows 10 机器上最新版本的 Java 上崩溃的 fatal error

docker - 为什么使用未检测到的 chromedriver 无法连接到 Chrome?

Java访问Window的 "Open with..."列表

linux - Dockerfile ADD 不起作用

node.js - 从另一个 Docker 容器运行 Zalenium 的 Selenium 命令

ubuntu - 在 Ubuntu 10.10 上安装 RVM 报错

c - 获取 “field has incomplete type” 和 "conflicting types"

eclipse - PyDev 插件找不到 python 3.4