I’ve just installed docker but I have to run it with sudo every time. If I don’t add sudo I get the following 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
Is there a way around that? I want to be able to run docker without having to type my password each time…
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Sign up for Infrastructure as a Newsletter.
Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Hello,
According to the official Docker docs here:
https://docs.docker.com/install/linux/linux-postinstall/#manage-docker-as-a-non-root-user
You need to do the following:
To create the docker group and add your user:
This command downloads a test image and runs it in a container. When the container runs, it prints an informational message and exits.
If you initially ran Docker CLI commands using sudo before adding your user to the docker group, you may see the following error, which indicates that your
~/.docker/
directory was created with incorrect permissions due to the sudo commands.~/.docker/
directory (it is recreated automatically, but any custom settings are lost), or change its ownership and permissions using the following commands:Here’s also a quick video demo on how to do this:
Hope that this helps! Regards, Bobby
After an upgrade I got the permission denied. Doing the steps of ‘mkb’ post install steps don’t have change anything because my user was already in the ‘docker’ group; I retry-it twice any way without success.
After an search hour this following solution finaly worked :
While doing production config i got the permission issue.I tried below solution to resolve the issue.
Error Message**
Solution:permissions of the socket indicated in the error message, /var/run/docker.sock:
After changes permission for docket.sock then execute below command to check permissions.