Home >Operation and Maintenance >Docker >How to solve docker command without typing sudo

How to solve docker command without typing sudo

WJ
WJOriginal
2020-06-08 16:56:072684browse

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!

Statement:
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