By default, Docker requires sudo privileges to run. In order to execute commands without prepending “sudo” every time, simply run the two lines of code below. These simply add your currently logged in user to the “docker” group.
sudo groupadd docker sudo usermod -aG docker $USER
After executing, you may need to log off and log back in for it to take affect.