Monday, 15 June 2020

How to fix docker: Got permission denied while trying to connect to the Docker daemon socket

Method1:

  • Create the docker group.
sudo groupadd docker
  • Add your user to the docker group.
sudo usermod -aG docker ${USER}

  • clean the docker cache

rm -rf ~/.docker

  • update docker directory right

sudo chmod 666 /var/run/docker.sock

 

Method2:

You need to do the following:
To create the docker group and add your user:

  • Create the docker group.
sudo groupadd docker
  • Add your user to the docker group.
sudo usermod -aG docker ${USER}
  • You would need to override the docker permission
sudo chmod -R ugo+rw /var/run/docker.sock

sudo systemctl restart docker

sudo reboot / source ~/.bashrc

  • Verify that you can run docker commands without sudo.
docker run hello-world

No comments:

Post a Comment