Home >Operation and Maintenance >Docker >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 #更新用户组
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!