Recently, I installed Docker on Ubuntu. It was super easy. Gemini 2 5 0 9. But when I tried to run a docker command, it threw this error at me:
It’s not that I am trying to run something special. It happens for basic docker command like ps as well.
Strange, isn’t it? Let me show you how to get past this annoying error.
2495593 Update 4.0.1 for Microsoft.NET Framework 4 - Design-Time Update for Visual Studio 2010 SP1 After you apply this update, you can obtain a Multi-Targeting pack that supplies the reference assemblies for IntelliSense and for compilation that support the new functionality in this runtime update. Dec 08, 2016 What’s New in Version 1.4.0. Thanks for using Denied! Version 1.4.0 adds the following:. Import and export rules! Import a pre-made set of rules and make the Christmas season that much easier to bear. Export all the rules you’ve gathered as a backup, or to share them with your friends. If you’re enjoying Denied, consider leaving a review.
Fixing ‘Got permission denied while trying to connect to the Docker daemon socket’ error with Docker in Ubuntu
Denied 1 4 0 1
There are two ways to deal with it.
Fix 1: Run all the docker commands with sudo
Folx go 5 4 – manage and organize downloads pdf. If you have sudo access on your system, you may run each docker command with sudo and you won’t see this ‘Got permission denied while trying to connect to the Docker daemon socket’ anymore.
But running each and every docker command with sudo is super inconvenient. You miss adding sudo to the beginning and you’ll get ‘permission denied’ error again.
![Denied 1 4 0 x 2 Denied 1 4 0 x 2](https://i0.heartyhosting.com/www.nationalenquirer.com/wp-content/uploads/old_neq/article_images/aldean-stry.jpg?fit=480%2C700&ssl=1)
Fix 2: Running docker commands without sudo
To run the docker commands without sudo, you can add your user account (or the account you are trying to fix this problem for) to the docker group.
First, create the docker group using groupadd command. The group may already exist but running the group creation command won’t hurt.
Now that you have the docker group, add your user to this group with the usermod command. I am assuming that you are trying to do it for your own user account and in that case, you can use the $USER variable.
Denied 1 4 0 25
Verify that your user has been added to docker group by listing the users of the group. You probably have to log out and log in back again.
If you check your groups and docker groups is not listed even after logging out, you may have to restart Ubuntu. To avoid that, you can use the newgrp command liks this:
Now if you try running the docker commands without sudo, it should work just fine.
Further troubleshooting
In some cases, you may need to add additional permissions to some files specially if you have run the docker commands with sudo in the past.
You may try changing the group ownership of the /var/run/docker.sock file.
You may also try changing the group ownership of the ~/.docker directory.
And then try running docker with sudo. It should be fine.
I hope this little tutorial helped you to fix the annoying “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.39/containers/json: dial unix /var/run/docker.sock: connect: permission denied” error with Docker in Ubuntu.
Did it fix the problem for you? If yes, I welcome a quick comment of thanks from you. If not, I’ll be happy to help you fix this problem further.
Become a Member for FREE
Become a member to get the regular Linux newsletter (2-4 times a month) and access member-only content
Join the conversation.