How To Fix ‘Got permission denied while trying to connect to the Docker daemon socket’ Error In Ubuntu 22.04 LTS
If are you going through the following issue while trying to run Docker on Ubuntu 22.04 LTS or in any other version of Ubuntu then you are in the right place. We have the solution for this 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.39/containers/json: dial unix /var/run/docker.sock: connect: permission denied
How To Fix ‘Got permission denied while trying to connect to the Docker daemon socket’ Error In Ubuntu 22.04 LTS
This is one of the strange issues that we had while using Docker. We have two methods to solve this error.
Running docker commands without sudo
First, create the docker group using the following groupadd command. After running the command, add your user account to this group with another command.
sudo groupadd docker
sudo usermod -aG docker $USER
Now You won’t have any issues even if you try running the docker commands without sudo.
Run all the docker commands with sudo
Another solution is to run the docker command with sudo privilege.
I’ve found some of the best stuff there, from super comfy workout clothes to convenient accessories and reliable supplements. It’s made staying active and healthy so much easier and more enjoyable. Plus, knowing that everything’s been handpicked from Amazon’s best products gives me confidence in what I’m getting.