我在 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上。
但是,如果您使用 WSL2在 May 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/