Recent versions of docker create a docker group. So now you can add your user to the docker group so you don’t have to type sudo docker
when you want to run a docker command.
On ubuntu:
sudo gpasswd -a ${USER} docker
sudo service docker restart
shell (you have to login again)