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


15

我将docker snap软件包添加到了我的Ubuntu 16.04机器

sudo snap install docker

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

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

Answers:


11

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

为了获得有关如何解决(即破坏)限制模型直到适当的修复方法的有用指导。您可以简单地检查快照中打包的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.

最后一条命令失败...

$ newgrp docker-snap
newgrp: group 'docker-snap' does not exist

但是,我没有发现基于故障的任何负面影响,并且Docker现在可以按我预期的那样运行。


6

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


没有帮助:Cannot connect to the Docker daemon
maslick

0

我通过运行来工作:

sudo snap start docker

然后sudo在后续的docker命令上运行:

sudo docker-compose up --build

如果sudo在后续的docker命令上没有,该Cannot connect to the Docker daemon错误将继续存在。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.