Home >Operation and Maintenance >Docker >How to solve docker command without typing sudo
How to solve the problem that docker command does not require sudo?
Since the docker daemon needs to be bound to the Unix socket of the host instead of the ordinary TCP port, and the owner of the Unix socket is the root user, other users can only execute the relevant commands by adding the sudo option before the command. operate.
If you don’t want to type extra sudo every time you use the docker command, you can configure it as follows.
1. Create a docker group
$ sudo groupadd docker
2. Add the current user to the docker group
$ sudo usermod -aG docker $USER
3. Log out and log in again to the shell
4. Verify whether the docker command can run
$ docker run hello-world
Related recommendations:docker tutorial
The above is the detailed content of How to solve docker command without typing sudo. For more information, please follow other related articles on the PHP Chinese website!