Reference: https://stackoverflow.com/questions/51218233/docker-why-do-i-need-to-sudo-in-ubuntu

Docker: why do I need to sudo in Ubuntu?

I am working through this tutorial setting up Docker, and I’m finding that all of their examples are written like

docker run hello-world

but when I try it, it says permission denied on a socket and I have to do

sudo docker run hello-world

to run the examples. Why are root privileges necessary even for these simple examples?

Answer

Running a docker container requires the user to be a member of the docker group. By default, when you install docker, the only user that is added to it is root. You can add your own user to this group if you want to run docker containers from it.

I overlooked that aspect of the setup, here are proper instructions: https://docs.docker.com/engine/install/linux-postinstall/

To create the docker group and add your user:

  1. Create the docker group.

    $ sudo groupadd docker
    
  2. Add your user to the docker group.

    $ sudo usermod -aG docker $USER
    
  3. Log out and log back in so that your group membership is re-evaluated.

Why docker command need sudo? | 为什么运行docker命令需要sudo?相关推荐

  1. centos sudo不能运行_Linux操作系统中sudo的使用和sudoers配置

    sudo 是linux下常用的允许普通用户使用超级用户权限的工具; 允许系统管理员让普通用户执行一些或者全部的root命令,如halt,reboot,su等等.这样不仅减少了root用户的登陆和管理时 ...

  2. centos sudo不能运行_Linux命令su、sudo、sudo su、sudo -i使用和区别

    sudo 与 su 两个命令的最大区别是: 物联网开发入门直播课 - 嵌入式/物联网-快速上手linux - 创客学院直播室​www.makeru.com.cn sudo 命令需要输入当前用户的密码, ...

  3. 【docker】使用云服务器运行docker时无法访问宿主机的映射端口

    导语:这几天在学docker,在学到容器映射端口时,总是无法访问到宿主机的对应端口,这就很纳闷了,IP地址和端口号都是对应的,eth0的IP地址加上容器外端口.不过想了一下,唯一区别是我在云服务器上跑 ...

  4. php artisan command,从php函数运行artisan命令

    我发现它,在PassportServiceProvider的boot()方法中有一个检查,基本上阻止它从Artisan :: call调用. //PassportServiceProvider.php ...

  5. abp 打包部署到ubuntu_如何在Ubuntu中安装Docker和运行 Docker容器

    Docker是一种开源且流行的操作系统级虚拟化(俗称"容器化")技术,主要在Linux和Windows上运行. Docker使用容器可以更轻松地创建,部署和运行应用程序. 使用容器 ...

  6. Docker——使用docker工具管理软件/组件的运行,镜像、容器、数据卷的基本概念,常用指令,使用docker搭建Java微服务运行环境

    Docker--使用docker工具管理软件/组件的运行,镜像.容器.数据卷的基本概念,常用指令,使用docker搭建Java微服务运行环境 一.docker的安装和卸载 1.卸载 2.安装 3. 导 ...

  7. aws 亚马逊 服务器 运行docker run报错 Got permission denied while trying to connect to the Docker daemon socket

    问题: 当aws亚马逊服务器使用ec2-user运行docker run创建实例时,因为ec2-user没有权限所以会报错Got permission denied while trying to c ...

  8. 一、Docker:Linux/Windows在线安装Docker与命令大全总结

    Docker是一种基于Linux的开源的应用容器引擎,它能够实现一个隔离的.安全的.独立的容器环境,在这个容器中可以安装各种产品,例如MySQL.Nginx.Python.Redis等,并且能够实现秒 ...

  9. 老司机实战Windows Server Docker:3 单节点Windows Docker服务器简单运维(上)

    经过上两篇实战Windows Server Docker系列文章,大家对安装Windows Docker服务以及如何打包现有IIS应用为docker镜像已经有了基本认识.接下来我们来简单讲讲一些最基本 ...

最新文章

  1. Data - 深入浅出学统计 - 上篇
  2. python怎么画条形图-Python 画 直方图/条形图/柱状图
  3. 用servlet校验密码2
  4. setInterval(callback(),time)
  5. pytorch教程龙曲良46-55
  6. mac10.12 安装mysql_在mac os10.12上安装mysql5.7.18
  7. 评分较高对鸿蒙文,万倍增幅:鸿蒙至高神,加入诸天万界群
  8. for循环的使用步骤 1104
  9. winform combobox 单机不关闭_单机脉冲除尘器铜仁单机脉冲除尘器参数
  10. python自动抠图软件_比PS还好用!Python 20行代码批量抠图
  11. 代码审查工具 phabricator 使用学习
  12. 与报文交换比较,分组交换有哪些优点?
  13. Qt 如何获取本机ip地址
  14. Hive之数仓的分层及建模理论(3)
  15. 小身板干大事:DATAhawk无人机独创手抛起飞实现3厘米精准测绘
  16. L2TP 配置 实践出配置
  17. linux 命令行 迅雷替代,Mac/Linux下迅雷替代方案
  18. 网页部署https后浏览器访问风险提示或者您的链接不是私密链接解决方案
  19. 精通C++,该如何学? 网友:船长一语中的啊。。。
  20. 孤尽31天-day02

热门文章

  1. POJ - 2104 K-th Number(主席树)
  2. TensorFlow2-自编码器
  3. 机器学习-机器学习概论(入门机器学习基础知识)
  4. HDU3892(多项式域欧几里德算法)
  5. Timus1430(裴蜀定理应用)
  6. 指数型生成函数[bzoj3456]城市规划
  7. 逆向工程核心原理学习笔记(十四):栈帧1
  8. QUIC 之类的可靠传输协议
  9. 字符串匹配--Sunday算法
  10. 大厂中秋礼盒大PK!祝大家中秋快乐,送大家鹅厂月饼礼盒!