Easy setup to run docker command without sudo (Linux)

When I run the docker command on Linux without sudo, I get the following permission error:

Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.40/containers/json: dial unix /var/run/docker.sock: connect: permission denied

By default, root execute permission is required, but you can use the following procedure to hit the docker command without sudo.

#Create docker user group
sudo groupadd docker
#Add current user to docker group
sudo usermod -aG docker $USER
#Immediately reflect changes
newgrp docker

Annotation

reference

Recommended Posts

Easy setup to run docker command without sudo (Linux)
Try to use docker command without sudo.
Decomposing the Docker run command. .. ..
Introduction to Linux Container / Docker (Part 1)
Steps to run docker on Mac
How to run JavaFX on Docker
Introduction to Linux Container / Docker (Part 2)
How to run a GIF file from the Linux command line (Ubuntu)
Grant docker command execution permission to ec2-user
Run Embulk on Docker to convert files
[Linux convenient command] Try to insert delta
How to run Blazor (C #) with Docker
Docker command
I made a Docker container to run Maven
Command to stop or delete all Docker resources
Easy to display hello world with Rails + Docker
Docker command to create Rails project with a single blow in environment without Ruby