2019独角兽企业重金招聘Python工程师标准>>>

https://docs.docker.com/installation/ubuntulinux/#giving-non-root-access

https://ubuntuincident.wordpress.com/2014/01/10/docker/

Create a docker group

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 dockerand add users to it. When the docker daemon starts, it makes the ownership of the Unix socket read/writable by the docker group.

Warning: The docker group is equivalent to the root user; For details on how this impacts security in your system, see Docker Daemon Attack Surface for details.

To create the docker group and add your user:

  1. Log into Ubuntu as a user with sudo privileges.

    This procedure assumes you log in as the ubuntu user.

  2. Create the docker group and add your user.

    $ sudo usermod -aG docker ubuntu
  3. Log out and log back in.

    This ensures your user is running with the correct permissions.

  4. Verify your work by running docker without sudo.

    $ docker run hello-world

Execute docker as non-root
As you noticed, docker must be executed with sudo. If you want to execute it with your non-root account, here is what to do:

1
2
3
4
5
6
# create the 'docker' group
$ sudo groupadd docker  # probably it already exists
# add your user to the 'docker' group
$ sudo gpasswd -a USER docker  # replace USER with your user name
# restart the service
$ sudo service docker restart

You will have to log out and log back in to make the group settings active on your account. After that you can launch docker without sudo:

1
2
3
4
5
6
7
$ docker images
REPOSITORY          TAG                 ID                  CREATED             SIZE
ubuntu              12.04               8dbd9e392a96        4 months ago        131.5 MB (virtual 131.5 MB)
ubuntu              12.10               b750fe79269d        5 months ago        24.65 kB (virtual 180.1 MB)
ubuntu              latest              8dbd9e392a96        4 months ago        131.5 MB (virtual 131.5 MB)
ubuntu              precise             8dbd9e392a96        4 months ago        131.5 MB (virtual 131.5 MB)
ubuntu              quantal             b750fe79269d        5 months ago        24.65 kB (virtual 180.1 MB)


转载于:https://my.oschina.net/dexterman/blog/397450

Install and Run Docker on NON ROOT相关推荐

  1. dial unix /var/run/docker.sock: connect: permission denied

    今天刚遇到的一个问题,使用非root用户时操作docker提示无权限,在查阅了一些文章之后自己又摸索出了一些更方便的方法,顺手记录下来. 一.问题发现 二.使用root用户进行操作 1. 临时使用ro ...

  2. 多种方法解决docker无权限问题 /var/run/docker.sock: connect: permission denied

    问题:无权限使用docker命令 报错信息 [test@pri00 ~]$ docker ps Got permission denied while trying to connect to the ...

  3. Docker容器的root用户

    Docker 是 Linux 平台上容器的管理引擎,其提供的容器服务一方面可以很好地分配物理资源,不论是资源还是权限都能够达到隔离的效果:另一方面,Docker 的设计把更多的目光投向了「应用」本身, ...

  4. 【WSL2】ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemo

    ➜ build git:(master) ✗ cmake .. -DHTTP_PROXY=http://192.168.50.65:7890 ➜ build git:(master) ✗ make b ...

  5. 解决:Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

    [root@iZbp12f9404um3f6avsm29Z ~]# docker ps Cannot connect to the Docker daemon at unix:///var/run/d ...

  6. Docker报错Cannot connect to the Docker daemon at unix:///var/run/docker.sock. ...

    Cannot connect to the Docker daemon at unix:///var/run/docker.sock. ... 方法 sudo service docker resta ...

  7. Install and run DB Query Analyzer 6.04 on Microsoft Windows 10

          Install and run DB Query Analyzer 6.04 on Microsoft Windows 10  DB Query Analyzer is presented ...

  8. 执行docker命令,出现Cannot connect to the Docker daemon at unix:///var/run/docker.sock.

    执行docker ps命令,出现:Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker d ...

  9. cannot connect to the docker daemon at unix:///var/run/docker.sock. is the d完美解决

    docker出现如下错误:Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemo ...

最新文章

  1. 重庆找Java开发工作_重庆【Java开发程序员】
  2. 《汇编语言》王爽—第七章实验六详解
  3. 《CLR Via C# 第3版》笔记之(四) - 类中字段的默认赋值
  4. html页脚显示不出来,CSS实例:让页脚保持在未满屏页面的底部
  5. 杭州电子科技大学考研经验贴
  6. Redis实现分布式session功能的共享
  7. sublime清除html里面的空白行,Sublime Text批量删除空白行和注释代码
  8. 数据+人工智能+模型——北京市新一代交通仿真模型框架
  9. 别再让「聪明」害了00后!
  10. 程序员的数学思维修炼(趣味解读)还有哪些进制
  11. 固态硬盘的计算机需要进行磁盘碎片整理吗,SSD固态硬盘需要碎片整理吗 固态盘切忌磁盘碎片整理...
  12. 计算机安全模式还原系统,Win10电脑安全模式怎么还原系统?Win10电脑安全模式还原系统方法步骤...
  13. 【Web技术】网站留言系统开发,及留言信息实时发送至指定邮箱
  14. MAC 修改环境变量
  15. 解决对路径bin\roslyn..的访问被拒绝
  16. 云计算的模型都有哪些
  17. matlab url什么意思,URL是什么 url是什么意思?
  18. 代理IP的背后原理简单介绍与python写一个获取代理IP的爬虫
  19. fastadmin框架进行开发【1】
  20. C++ 解析XML下载类

热门文章

  1. eclipse工程运行正常但是工程有红叉的问题
  2. c语言中八进制转换成十进制数,C语言中的二进制、八进制、十进制之间的转换...
  3. cocos2dx linux eclipse,如何将cocos2dx移植到eclipse上?
  4. mysql 事务 select_mysql 多个select需要放入一个事务吗?
  5. WINDOWS下面使用ICE操作记录
  6. jQuery常用选择器有哪些?
  7. Java实训项目2:GUI学生信息管理系统 - 系统概述
  8. 大数据学习笔记29:Hadoop压缩机制演示
  9. win7开启ftp被动模式_FTP服务器在Linux系统上的搭建
  10. Intel 64/x86_64/IA-32/x86处理器 - 通用指令(5) - 控制转移指令