当我们试图运行对接命令时,我们得到了这个错误。例如:
$ 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组的成员控制对接守护进程。
但是在重新启动服务时遇到了困难
$ sudo service docker restart
Failed to restart docker.service: Unit docker.service not found.我们正在使用
$ docker -v
Docker version 18.06.1-ce, build e68fc7a在……上面
$ 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组,我们也是该组的成员。
$ grep docker /etc/group
docker:x:1001:siddjain此外,我们确实登出并重新登录。我们能够使用sudo运行对接命令。也是
$ sudo snap services
Service Startup Current Notes
docker.dockerd enabled active -有人能帮我们吗?
发布于 2019-01-30 19:55:32
解决方案是使用snap重新启动坞守护进程(因为我们就是这样安装的)
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命令。
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是短命的,因为我们在试图运行另一个集装箱时,立即遇到了另一个错误。
mkdir /var/lib/docker: read-only file system要修复它,我们必须再次卸载和重新安装docker --这一次是从正式文档(如描述的这里 )中重新安装。
https://stackoverflow.com/questions/54448146
复制相似问题