How to solve docker command without typing sudo

WJ
Release: 2020-06-08 16:56:07
Original
2602 people have browsed it

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
Copy after login

2. Add the current user to the docker group

$ sudo usermod -aG docker $USER
Copy after login

3. Log out and log in again to the shell

4. Verify whether the docker command can run

$ docker run hello-world
Copy after login

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!

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!