Skip to content

Instantly share code, notes, and snippets.

@hrabryi
Last active July 21, 2020 19:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hrabryi/d24c8ba9058cbe81151e5b919d0114c7 to your computer and use it in GitHub Desktop.
Save hrabryi/d24c8ba9058cbe81151e5b919d0114c7 to your computer and use it in GitHub Desktop.
Run Docker as non-root user (without sudo)in ubuntu/linux
To fix the Docker permission denied error and use Docker as non-root user,
(like Got permission denied while trying to connect to the Docker daemon socket at...connect: permission denied)
create a group called “docker” with the following command:
$ sudo groupadd docker
Next, add your user to the docker group:
$ sudo usermod -aG docker $USER
After adding the user to the docker group, log out and log back in to take effect the changes.
Alternatively, run the following command to apply the changes to groups:
$ newgrp docker
From now on, the normal (non-root) user can be able to use Docker without sudo permissions.
$ docker version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment