Docker启动时提示Get Permission Denied while trying to connect解决方法
环境描述
vmware15虚拟机安装centos7.4 64位系统,docker版本19.03.2
问题描述
安装完docker后,执行docker相关命令
docker run ubuntu:15.10 /bin/echo "Hello world"
出现如下提示:
docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.40/containers/create: 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命令
#如下命令可以正常执行
sudo docker run ubuntu:15.10 /bin/echo "Hello world"
解决方法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正常使用
本文转自:https://www.fengjunzi.com/blog-25467.html
欢迎访问我的个人网站风君子博客,微信fj3702交流
Docker启动时提示Get Permission Denied while trying to connect解决方法的更多相关文章
- 解决Docker运行命令时提示"Got permission denied while trying to connect to the Docker daemon socket"类情况
Docker安装命令: 解决Docker运行命令时提示"Got permission denied while trying to connect to the Docker daemon ...
- Ubuntu 14.04.4 下 scp 远程拷贝提示:Permission denied, please try again. 的解决办法
我在 s0 主机上远程拷贝 /etc/hosts 文件到 s1 主机上,出现下面的错误提示: qiao@s0:~$ scp /etc/hosts root@s2:/etc/root@s2's pass ...
- window10上登录Oracle时提示ORA-12546:Permission denied
在64位的Windows 10上安装了Oracle 10.2.0.4的64位版,遇到不少问题. 虽然可能现在安装这个版本越来越少,还是分享出来,希望能帮助到一些人. 1.安装的过程遇到的问题 在普通用 ...
- Idea运行web项目时,提示java.lang.ClassNotFoundException: com.mysql.jdbc.Driver解决方法
今天用 idea写了个工程.结果最后报错,错误信息如下: java.lang.ClassNotFoundException: com.mysql.jdbc.Driverat org.apache.ca ...
- linux启动tomcat很久或者很慢Tomcat启动时卡在“INFO: Deploying web application directory ......”的解决方法
解决方案: 找到jdk1.x.x_xx/jre/lib/security/java.security文件,在文件中找到securerandom.source这个设置项,将其改为: securerand ...
- Tomcat启动时卡在“INFO: Deploying web application directory ......”的解决方法
https://blog.csdn.net/njchenyi/article/details/46641141
- docker Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post
利用docker构建时,报错 + docker pull maven:3-alpine Got permission denied while trying to connect to the Doc ...
- FTP服务FileZilla Server上传提示550 Permission denied
原文地址:https://help.aliyun.com/knowledge_detail/5989224.html 相关文章 1.filezilla通过root账户远程连接管理ubuntu serv ...
- 启动docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock
启动docker提示: docker: Got permission denied while trying to connect to the Docker daemon socket at uni ...
随机推荐
- HTTP_header安全选项(浅谈)
HTTP报文头-安全问题 Mirror王宇阳 2019-10-01 参考:MDN技术文档:<http头安全相关的选项_by`myh0st> 认识HTTP协议 https://www.cnb ...
- Gradle-任务
任务结果标签 当 Gradle 执行一个任务时,它会在控制台和 Tooling API 根据任务结果给任务打标签. 这些标签是根据任务是否有操作,是否应该执行操作,是否执行了操作以及这些操作做了哪些改 ...
- linux中关于权限的一些事
权限这个东西对于初学者来说可能会有点陌生,不过不要紧,看完下面的讲解应该会对你有一定的帮助 权限rwx rwxrwxrwx u g o a r:可读 4 w: ...
- Appium(五):Desired Capabilities
1. Desired Capabilities Desired Capabilities简单来说就是一组设置,这些设置可以让测试脚本控制Appium的运行行为.下面就逐个对Desired Capabi ...
- Cocos Creator 资源加载流程剖析【三】——Load部分
Load流程是整个资源加载管线的最后一棒,由Loader这个pipe负责(loader.js).通过Download流程拿到内容之后,需要对内容做一些"加载"处理.使得这些内容可以 ...
- 精通awk系列(12):awk getline用法详解
回到: Linux系列文章 Shell系列文章 Awk系列文章 getline用法详解 除了可以从标准输入或非选项型参数所指定的文件中读取数据,还可以使用getline从其它各种渠道获取需要处理的数据 ...
- JVM进入老年代情况
1.躲过15次GC之后进入老年代 默认的设置下,当对象的年龄达到15岁的时候,也就是躲过15次Gc的时候,他就会转移到老年代中去 这个具体是多少岁进入老年代,可以通过JVM参数 “-XX:MaxTen ...
- nginx将http升级到https并且同时支持http和https两种请求、http自动转向https
1.http升级到https 1.1.检查 Nginx 是否支持 SSL /usr/local/nginx/sbin/nginx -V configure arguments中是否有--with-ht ...
- Vue 中的keep-alive 什么用处?
keep-alive keep-alive是Vue提供的一个抽象组件,用来对组件进行缓存,从而节省性能,由于是一个抽象组件,所以在v页面渲染完毕后不会被渲染成一个DOM元素 <keep-aliv ...
- dedecmsV5.7 插入记录并返回刚插入数据的自增ID
//插入一条数据 $sql = "INSERT INTO `table_name` (`name`,age) VALUES ('小明','23')"; $dsql->SetQ ...