Linux 下非root用户使用docker

通常我们使用linux系统的时候,最好是不要直接使用root账号,但是使用Docker的时候,默认又是不能使用非root用户的,关于原因,官方说法如下:

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 access it with sudo. For this reason, docker daemon always runs as the root user.

To avoid having 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.

下面是让非root用户可用root的步骤:

1

创建docker组

sudo groupadd docker

2

将当前用户加入docker组

sudo gpasswd -a ${USER} docker

3

重新启动docker服务(下面是CentOS7的命令)

sudo systemctl restart docker

4

当前用户退出系统重新登陆

5

运行docker命令,测试

docker ps

参考:http://blog.csdn.net/kongxx/article/details/52413332

最新文章

  1. 【原】使用Bmob作为iOS后台开发心得——查询关联关系(BmobRelation)
  2. [01] cocos2d-x开发环境搭建
  3. php数组函数分析--array_column
  4. python迭代器与iter()函数实例教程
  5. Android progressbar 详解
  6. 用O(1)的时间复杂度,找到栈和队列中的最小(大)值
  7. The required Server component failed to start so Tomcat is unable to start解决之一
  8. UnitOfWork机制的实现和注意事项
  9. CSS3/SVG clip-path路径剪裁遮罩属性简介
  10. XSS漏洞(跨站脚本)
  11. 微信分享jssdk config:invalid signature 签名错误
  12. Android项目记录点滴2
  13. 软件测试作业3 — PrintPrimes()
  14. MySQL 启动参数说明及性能优化建议
  15. HashMap实现原理和源码解析
  16. 《HelloGitHub》第 30 期
  17. 使用Asp.Net Core MVC 开发项目实践[第一篇:项目结构说明]
  18. 服务器端事件发送SSE
  19. 将项目安装到Maven本地资源库
  20. 关于“Durian”调查问卷的心得体会

热门文章

  1. dataGrideView的使用
  2. bzoj 4898: [Apio2017]商旅
  3. bzoj 3531: [Sdoi2014]旅行
  4. touchstart和touchend事件
  5. [知了堂学习笔记]_用JS制作《飞机大作战》游戏_第4讲(创建敌方飞机、敌方飞机发射子弹、玩家子弹击中敌方小飞机,小飞机死亡)
  6. Linux第三节整理 、增删改查、用户管理
  7. rmdir 命令详解
  8. ActiveMQ (三) 讯息传送机制以及ACK机制
  9. Visual Representation of SQL Joins
  10. 编译TensorFlow源码