By default, you have to run docker
using sudo
. When you try to run it without sudo, you will get
$ docker images
Got permission denied while trying to connect to the Docker daemon socket
In order to run without sudo, you will need to do the following steps
- Add the docker group if it does not already exist
sudo groupadd docker
- Add the user to the docker group. If you want to add the current user, you can just use this
sudo gpasswd -a $USER docker
If you want to add, say user user1
, then you should just do
sudo gpasswd -a user1 docker
After you do the above steps, log out and now you can run docker
without sudo
.
Comments