Docker without sudo

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.32/containers/json: dial unix /var/run/docker.sock: connect: permission denied

Solution nr. 1 (as root)

sudo usermod -a -G docker $USER

Solution nr. 2 (as not-root)

sudo groupadd docker
sudo usermod -aG docker $USER
// Either do a newgrp docker or log out/in to activate the changes to groups

https://askubuntu.com/questions/477551/how-can-i-use-docker-without-sudo

https://docs.docker.com/engine/installation/linux/linux-postinstall/#manage-docker-as-a-non-root-user