在Ubuntu 14.04上运行没有sudo的docker [英] Running docker without sudo on Ubuntu 14.04

查看:195
本文介绍了在Ubuntu 14.04上运行没有sudo的docker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试设置Docker,以便在使用它之前不必键入sudo.

I attempted to set up Docker so that I do not have to type sudo before using it.

我采取的步骤:

  1. 我首先使用sudo groupadd docker创建一个docker组;
  2. 我通过sudo gpasswd -a ${USER} docker将当前用户添加到"docker"组;
  3. 我用sudo service docker restart重新启动了docker;
  4. 我关闭并打开终端以开始新的会话.
  1. I started with creating a docker group with sudo groupadd docker;
  2. I added my current user to the "docker" group with sudo gpasswd -a ${USER} docker;
  3. I restarted docker with sudo service docker restart;
  4. I closed and opened the terminal to start a new session.

运行docker run hello-world后,我收到以下输出:

After running docker run hello-world, I receive this output:

FATA [0000]发表 http:///var/run/docker .sock/v1.17/containers/create :拨打Unix/var/run/docker.sock:权限被拒绝.您是否要连接到没有TLS的启用TLS的守护程序?

FATA[0000] Post http:///var/run/docker.sock/v1.17/containers/create: dial unix /var/run/docker.sock: permission denied. Are you trying to connect to a TLS-enabled daemon without TLS?

令人困惑的一件事(可能会提示为什么我必须在没有sudo的情况下才能运行docker):

One thing that puzzles (and might give a hint about why I cannot run docker without sudo) is the output of:

$ groups:是:

ltarasiewicz adm cdrom sudo dip plugdev lpadmin sambashare

ltarasiewicz adm cdrom sudo dip plugdev lpadmin sambashare

(没有"docker"组)

(no "docker" group)

$ groups ltarasiewicz的输出:

ltarasiewicz adm cdrom sudo dip plugdev lpadmin sambashare docker

ltarasiewicz adm cdrom sudo dip plugdev lpadmin sambashare docker

(码头工人"是其中一员)

("docker" is one of the groups)

将我的当前用户添加到"docker"组后,仍然无法使用sudo的Docker的原因可能是什么?

What might be the reason for the fact that I still cannot use Docker withou sudo after adding my current user to the "docker" group?

推荐答案

组更改不会在当前登录的会话中立即生效.您的选择包括:

Group changes don't take effect immediately in the currently logged in session. Your options include:

  1. 注销然后重新登录
  2. 开始新的登录会话(对于bash,这是通过bash -l命令进行的操作)
  1. Log out then log back in
  2. Start a new login session (for bash this is with the bash -l command)

这篇关于在Ubuntu 14.04上运行没有sudo的docker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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