-2

When I try to run any docker command, for example docker ps, I'm getting 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.40/containers/json: dial unix /var/run/docker.sock: connect: permission denied

So I manage to run it using sudo:

sudo docker ps

But I want to be able to run that without sudo.

Alon
  • 7,653
  • 20
  • 76
  • 132
  • Please have a look [here](https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user) – rph Jun 01 '20 at 17:29
  • Can you share the search terms you used when you Googled for the resolution to this? – dfundako Jun 01 '20 at 17:29

1 Answers1

2

In order to achieve the desired result you have to do the post-installation steps described in the documentation:

  1. Create the docker group.

    $ sudo groupadd docker
    
  2. Add your user to the docker group.

    $ sudo usermod -aG docker $USER
    
  3. Log out and log back in so that your group membership is re-evaluated.

John Kugelman
  • 330,190
  • 66
  • 504
  • 555
Danizavtz
  • 2,845
  • 4
  • 25
  • 22