Do I need root privileges to run docker?

angryTom
Release: 2020-03-14 17:19:09
Original
6933 people have browsed it

Do I need root privileges to run docker?

Do you need root permissions to run docker?

You need root permissions to run docker.

Recommended learning: docker tutorial.

To solve the problem that non-root users do not have permission to run docker commands, the method is as follows:

Method 1:

Use sudo to obtain administrator permissions and run docker command, this method has many limitations when executing docker commands through scripts

Method 2:

When the docker daemon is started, it will be given a name by default Give the docker user group permission to read and write Unix sockets. Therefore, as long as you create a docker user group and add the current user to the docker user group, the current user will have permission to access the Unix socket, and then you can execute docker related commands

sudo groupadd docker     #添加docker用户组
sudo gpasswd -a $USER docker     #将登陆用户加入到docker用户组中
newgrp docker     #更新用户组
Copy after login

PHP Chinese website, a large number of docker operation and maintenance tutorials and laravel framework tutorials, welcome to learn.

The above is the detailed content of Do I need root privileges to run docker?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!