以非root用户身份运行Docker [英] Running Docker as non-root user

查看:638
本文介绍了以非root用户身份运行Docker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图以非root用户身份运行docker。当我尝试,我得到以下错误:

  $ docker ps 
FATA [0000]获取http:// /var/run/docker.sock/v1.18/containers/json:dial unix /var/run/docker.sock:permission denied。您是否尝试连接到不带TLS的启用TLS的守护程序?

我可以以root身份运行docker:

  $ sudo docker ps 
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[...]
  $ groups 
域用户docker suappprod stashadmin config_mgmt远程服务器访问sudevmail sudevsvn

但是,仍然看来,该用户无法运行大多数docker命令,而不会以root身份sudoing 。



我在旧版本的docker:

  $ docker --version 
Docker版本1.6.1,build a8a31ef / 1.6.1

我知道最新的是1.10,我们公司有可能更新所有的Docker安装到1.9.2,但这将花费大量的精力和时间。



是否有东西否则我需要看看?用户已经登录多次。我还没有重新启动系统。

解决方案

检查这个命令给
- > ls -l /var/run/docker.sock
您可能想使用chmod更改此文件的权限(例如:$ code> sudo chmod 777 / var /运行/ docker.sock ),具体取决于您要授予的权限。


I'm trying to run docker as a non-root user. When I try, I get the following error:

$ docker ps
FATA[0000] Get http:///var/run/docker.sock/v1.18/containers/json: dial unix /var/run/docker.sock: permission denied. Are you trying to connect to a TLS-enabled daemon without TLS? 

I can run docker as root:

$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
[...]

I've put this user into a Unix group docker:

$ groups
domain users docker suappprod stashadmin config_mgmt remote server access sudevmail sudevsvn

However, it still appears that this user cannot run most of the docker commands without sudoing as root.

I am on an older version of docker:

$ docker --version
Docker version 1.6.1, build a8a31ef/1.6.1

I know that the latest is 1.10, and it's possible for our company to update all of the docker installs to 1.9.2, but that will take a lot of effort and time.

Is there something else I need to look at? The user has been logged in and out multiple times. I have not rebooted the system yet.

解决方案

Check what this command gives --> ls -l /var/run/docker.sock You may want to change the permissions of this file using chmod (Ex: sudo chmod 777 /var/run/docker.sock) depending on what permissions you want to give.

这篇关于以非root用户身份运行Docker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆