DOCKERFILE add user to group docker - Evanto/qna GitHub Wiki
After installing Docker, try running
docker ps
If you're getting the following 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
add your current user to the 'docker' group:
exec su -l $USER
Check that your user belongs to the 'docker' group now:
groups
The 'docker' group should be now listed in the output among other groups your current user belongs to.
NB: There are many ways of adding the current user to a group. Most of them require you to reload (close and open again) your shell (terminal) in order for the change to take effect. We use a command that doesn't need that to avoid starting a new shell. It creates a new subshell with loaded changes and replaces your current shell with it. One more command that does the same thing is:
newgrp docker
Example of a command that does the same but requires shell reloading after:
sudo gpasswd -a username docker
Links: