-1

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
  • 10,381
  • 23
  • 88
  • 152
  • 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

5

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
  • 349,597
  • 67
  • 533
  • 578
Danizavtz
  • 3,166
  • 4
  • 24
  • 25