在这篇文章中,我们将带领您了解GotpermissiondeniedwhiletryingtoconnecttotheDockerdaemonsocketatunix:///var/run/docke
在这篇文章中,我们将带领您了解Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.的全貌,同时,我们还将为您介绍有关Cannot connect to the Docker daemon at tcp://xxx.xx.x.x:2376. Is the docker daemon running?、Cannot connect to the Docker daemon at unix、Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?、Cannot connect to the Docker datemon at tcp://0.0.0.0:2375 is the docker daemon runing?的知识,以帮助您更好地理解这个主题。
本文目录一览:- Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.
- Cannot connect to the Docker daemon at tcp://xxx.xx.x.x:2376. Is the docker daemon running?
- Cannot connect to the Docker daemon at unix
- Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
- Cannot connect to the Docker datemon at tcp://0.0.0.0:2375 is the docker daemon runing?
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.
安装完docker后,执行docker相关命令,出现:
”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.26/images/json: dial unix /var/run/docker.sock: connect: permission denied“
原因
摘自docker mannual上的一段话:
Manage Docker as a non-root user The docker daemon binds to a Unix socket instead of a TCP port. By default that Unix socket is owned by the user root and other users can only access it using sudo. The docker daemon always runs as the root user. If you don’t want to use sudo when you use the docker command, create a Unix group called docker and add users to it. When the docker daemon starts, it makes the ownership of the Unix socket read/writable by the docker group
大概的意思就是:docker进程使用Unix Socket而不是TCP端口。而默认情况下,Unix socket属于root用户,需要root权限才能访问。
解决方法1
使用sudo获取管理员权限,运行docker命令
解决方法2
docker守护进程启动的时候,会默认赋予名字为docker的用户组读写Unix socket的权限,因此只要创建docker用户组,并将当前用户加入到docker用户组中,那么当前用户就有权限访问Unix socket了,进而也就可以执行docker相关命令
sudo groupadd docker #添加docker用户组 sudo gpasswd -a $USER docker #将登陆用户加入到docker用户组中 newgrp docker #更新用户组 docker ps #测试docker命令是否可以使用sudo正常使用
Cannot connect to the Docker daemon at tcp://xxx.xx.x.x:2376. Is the docker daemon running?
一.问题描述
在用docker部署jenkins实现自动化部署服务时,报错:
二.问题分析:
经前辈讲解得知,需要在Jenkins里面运行docker,而docker分为客户端和服务端,普通的docker命令由客户端操作,但客户端需要连接到服务端,而此时Jenkins是一个单独的容器,可以看做一个单独的系统,它不知道docker是谁,所以需要把docker映射进去了,但是我们映射的只是客户端,所以需要指定它连接到宿主机的服务端。在jenkins配置的docker也是客户端。
三.问题解决:
在运行jenkins时,挂载所需的环境,在用docker-compose运行时,可以直接在docker-compose.yml添加相应的映射环境
environment:
DOCKER_HOST: tcp://xx.xx.xx.xx:2376
然后在储存驱动修改映射
{
"hosts": [
"tcp://xx.xx.xx.xx:2376",
"unix:///var/run/docker.sock"
]
}
挂载相应文件目录
需要注意的是,上述映射的ip是jenkins所在的ip,因为jenkins是用户
Cannot connect to the Docker daemon at unix
记录一次宕机。
服务不可用,登录Linux
,尝试重启docker
容器,报:Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
错误。
查看磁盘占用:
df -h
100%占用。
定位到具体文件夹:
du -sh *|sort -hr
发现是一个日志文件达到了惊人的35G
...
是的,35G
,前菜狗后端看来比预期的还要菜。
清空日志文件:
> xxx.log
重启Docker:
systemctl daemon-reload
systemctl restart docker.service
服务恢复。
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
问题
在 WSL(Windows Subsystem for Linux )中运行 docker version
的时候,终端最后一行报错了
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
表明 docker 并没有正常启动,基本上就是要重启下 docker 就可以。
解决
小编的 WSL 安装的是 Ubuntu 系统,使用命令三成功启动 docker,不熟悉 Linux 的话,你可以依次尝试以下命令。
- 命令一
systemctl start docker
- 命令二
sudo dockerd
dockerd 是 docker 容器的守护程序服务,因为它不在后台运行,我们无法采取与服务相关的任何操作,需要重新启动。
- 命令三
sudo service --status-all
sudo service docker start
总结
以上就是小编在使用 docker 的过程中总结的一点经验,更多 docker 学习欢迎关注我的更新。
参考
- Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
- Cannot connect to the Docker daemon at unix:/var/run/docker.sock. Is the docker daemon running?****
Cannot connect to the Docker datemon at tcp://0.0.0.0:2375 is the docker daemon runing?
一、系统环境:
在Windows 7 64位上,采用Vmware workstation 12安装了CenOS7.5 64位。
二、问题
在CentOS7.5里安装了Docker,启动docker服务,输入docker version,则出现错误信息:
Cannot connect to the Docker datemon at tcp://0.0.0.0:2375 is the docker daemon runing?
三、解决过程
1、配置DOCKER_HOST
sudo vim /etc/profile.d/docker.sh
添加下面内容:
export DOCKER_HOST=tcp://localhost:2375
2、应用
1)、source /etc/profile
2)、source /etc/bashrc
3、配置启动文件
1)、sudo vim /lib/systemd/system/docker.service
2)、修改下面语句
ExecStart=/usr/bin/dockerd -H unix://
修改为:
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock -H tcp://0.0.0.0:7654
4、重载配置和重启
1)、sudo systemctl daemon-reload
2)、sudo systemctl restart docker.service
5、查看
docker version
说明已经正常。
关于Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.的介绍已经告一段落,感谢您的耐心阅读,如果想了解更多关于Cannot connect to the Docker daemon at tcp://xxx.xx.x.x:2376. Is the docker daemon running?、Cannot connect to the Docker daemon at unix、Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?、Cannot connect to the Docker datemon at tcp://0.0.0.0:2375 is the docker daemon runing?的相关信息,请在本站寻找。
本文标签: