[转]普通用户权限运行docker
官方文档地址:Linux post-installation steps for Docker Engine | Docker Documentation
官方文档权限介绍
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 preface the docker command with sudo, create a Unix group called docker and add users to it. When the Docker daemon starts, it creates a Unix socket accessible by members of the docker group.
普通用户执行权限添加
创建 docker 用户组
sudo groupadd docker
添加你想用普通用户权限的用户名到 docker 用户组
sudo usermod -aG docker $USER
系统重启后就可以使用普通用户权限执行 docker, 如果不想重启,可以使用下面的命令更新并激活组权限
newgrp docker
验证设置是否成功
docker run hello-world
如果出现下面错误提示,建议重启电脑:
WARNING: Error loading config file: /home/user/.docker/config.json -
stat /home/user/.docker/config.json: permission denied
本作品采用《CC 协议》,转载必须注明作者和本文链接
————————————————
原文作者:冰雪封存的记忆
转自链接:https://learnku.com/articles/64047
版权声明:著作权归作者所有。商业转载请联系作者获得授权,非商业转载请保留以上作者信息和原文链接。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
2021-08-04 [转]nginx安装及其配置详细教程
2018-08-04 [转]JS组件系列——表格组件神器:bootstrap table
2018-08-04 [转]我的MYSQL学习心得(六) 函数
2017-08-04 [转]JSP页面的动态包含和静态包含示例及介绍