gpt4 book ai didi

docker - 在没有root的情况下运行docker Rstudio服务器?

转载 作者:行者123 更新时间:2023-12-02 21:29:16 26 4
gpt4 key购买 nike

我刚刚开始玩docker。我做的第一件事是先安装它,然后再安装Rstudio服务器。 (我正在运行Ubuntu 14.04)

sudo apt-get install docker.io
sudo docker run -d -p 8787:8787 -e USER='some_user_name' -e PASSWORD='super_secret_password' rocker/hadleyverse

是否可以在没有sudo的情况下运行docker rstudio服务器?如果是这样,怎么办?

谢谢!

最佳答案

this answer:

docker manual可以这样说:

Giving non-root access

The docker daemon always runs as the root user, and since Docker version 0.5.2, 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 so, by default, you can access it with sudo.

Starting in version 0.5.3, if you (or your Docker installer) create a Unix group called docker and add users to it, then the docker daemon will make the ownership of the Unix socket read/writable by the docker group when the daemon starts. The docker daemon must always run as the root user, but if you run the docker client as a user in the docker group then you don't need to add sudo to all the client commands. As of 0.9.0, you can specify that a group other than docker should own the Unix socket with the -G option.

Warning: The docker group (or the group specified with -G) is root-equivalent; see Docker Daemon Attack Surface details.

Example:


  • 添加docker组(如果尚不存在)。
    sudo groupadd docker
  • 将连接的用户“$ {USER}”添加到docker组。更改用户名以匹配您的首选用户。
    sudo gpasswd -a ${USER} docker
  • 重新启动Docker守护程序:
    sudo service docker restart
  • 如果您使用的是Ubuntu 14.04及更高版本,请使用docker.io代替:
    sudo service docker.io restart
  • 如果您添加了当前登录用户,则需要注销并重新登录。
  • 关于docker - 在没有root的情况下运行docker Rstudio服务器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27272980/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com