1. Add the docker group if it doesn't already exist
sudo groupadd docker
2. Add the connected user $USER (current user) to the docker group
sudo gpasswd -a $USER docker
3. Restart the docker daemon
sudo service docker restart
The commands will look like this:
4.Restart the machine itself
sudo reboot
After rebooting the machine you will be able to run the docker commands without sudo:
You can confirm by running the following commands:
docker ps docker images