Problem scenario
You try to run a Docker command, but you get 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.29/containers/json?all=1: dial unix /var/run/docker.sock: connect: permission denied
What should you do?
Solution
Have you added the user who was trying to execute the command to the “docker” group?
This command would add the user jdoe to the “docker” group:
sudo usermod -aG docker jdoe
If you ran the above command as the jdoe user,
…