docker snap:无法连接到 Docker 守护进程。docker 守护进程是否在这台主机上运行?

Zac*_*lds 21 docker snap

我在我的 Ubuntu 16.04 机器上添加了 docker snap 包

sudo snap install docker
Run Code Online (Sandbox Code Playgroud)

现在,当我尝试使用它时,出现以下错误...

无法连接到 Docker 守护程序。docker 守护进程是否在这台主机上运行?

Zac*_*lds 16

由于不断发展的 snappy 模型中的限制问题,默认情况下 Docker 不是完整的(请参阅 Snapcraft 论坛上的讨论)。

获取有关如何解决(即打破)限制模型的一些有用说明,直到适当的修复到位。您可以简单地查看打包在 snap 包中的 Docker 帮助应用程序。

$ docker.help
Docker snap: Docker Linux container runtime.

Due to the confinement issues on snappy, it requires some manual setup to make docker-snap works on your machine.
We'll take you through the steps needed to set up docker snap work for you on ubuntu core and ubuntu classic.

On Ubuntu classic, before installing the docker snap, 
please run the following command to add the login user into docker group.
    sudo addgroup --system docker
    sudo adduser $USER docker
    newgrp docker

On Ubuntu Core 16, after installing the docker snap from store,
Firstly, you need to connect the two interfaces as they're not auto-connected by default.
    sudo snap connect docker:account-control :account-control
    sudo snap connect docker:home :home

Secondly, reload the snap and allows the user to login to the new group "docker-snap".
    snap disable docker
    snap enable  docker
    newgrp docker-snap

Then have fun with docker in snappy.
Run Code Online (Sandbox Code Playgroud)

最后一条命令失败...

$ newgrp docker-snap
newgrp: group 'docker-snap' does not exist
Run Code Online (Sandbox Code Playgroud)

但是,我没有注意到基于失败的任何负面影响,Docker 现在按我的预期运行。


小智 9

使用snap start docker激活服务。它可能需要 root 权限。


小智 6

如果 ...

sudo snap start docker
Run Code Online (Sandbox Code Playgroud)

...没有帮助,尝试删除并重新安装 docker

sudo snap remove docker --purge
Run Code Online (Sandbox Code Playgroud)

这也将删除 docker 创建的图像、容器和内容

sudo snap install docker
Run Code Online (Sandbox Code Playgroud)