我在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服务会停止,如何使其保持运行状态?