首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >试图连接到unix://var/run/docker.sock上的Docker守护进程套接字时拒绝的权限

问试图连接到unix://var/run/docker.sock上的Docker守护进程套接字时拒绝的权限
EN

Stack Overflow用户
提问于 2019-01-30 19:28:45
回答 1查看 14.8K关注 0票数 0

当我们试图运行对接命令时,我们得到了这个错误。例如:

代码语言:javascript
复制
$ docker image ls
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.38/images/json: dial unix /var/run/docker.sock: connect: permission denied

因此,我们遵循步骤这里,但问题仍然存在。然后我们看到了这的问题,它的建议是什么?

您必须重新启动对接守护进程,否则它将不让docker组的成员控制对接守护进程。

但是在重新启动服务时遇到了困难

代码语言:javascript
复制
$ sudo service docker restart
Failed to restart docker.service: Unit docker.service not found.

我们正在使用

代码语言:javascript
复制
$ docker -v
Docker version 18.06.1-ce, build e68fc7a

在……上面

代码语言:javascript
复制
$ uname -a
Linux jnj 4.15.0-1036-azure #38-Ubuntu SMP Fri Dec 7 02:47:47 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

已成功创建了docker组,我们也是该组的成员。

代码语言:javascript
复制
$ grep docker /etc/group
docker:x:1001:siddjain

此外,我们确实登出并重新登录。我们能够使用sudo运行对接命令。也是

代码语言:javascript
复制
$ sudo snap services
Service         Startup  Current  Notes
docker.dockerd  enabled  active   -

有人能帮我们吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-01-30 19:55:32

解决方案是使用snap重新启动坞守护进程(因为我们就是这样安装的)

代码语言:javascript
复制
siddjain@jnj:~$ sudo snap stop docker
Stopped.
siddjain@jnj:~$ snap start docker
error: access denied (try with sudo)
siddjain@jnj:~$ sudo snap start docker
Started.

之后,我们可以不需要sudo就可以运行docker命令。

代码语言:javascript
复制
siddjain@jnj:~$ docker run hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

siddjain@jnj:~$ 

我们的joy是短命的,因为我们在试图运行另一个集装箱时,立即遇到了另一个错误。

代码语言:javascript
复制
mkdir /var/lib/docker: read-only file system

要修复它,我们必须再次卸载和重新安装docker --这一次是从正式文档(如描述的这里 )中重新安装。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54448146

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档