Docker without sudo in Ubuntu 20.04?

I've just installed docker on Ubuntu 20.04 and noticed that docker must be run as sudo.

wolf@linux:~$ docker ps
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.24/containers/json: dial unix /var/run/docker.sock: connect: permission denied
wolf@linux:~$ 

wolf@linux:~$ sudo docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
wolf@linux:~$ 

Found this tutorial and tried to follow it

Step 2 — Executing the Docker Command Without Sudo (Optional)

https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-20-04

wolf@linux:~$ sudo usermod -aG docker ${USER}
wolf@linux:~$ su - ${USER}
Password: 
wolf@linux:~$

It seems to be fine here.

wolf@linux:~$ id -nG
wolf docker
wolf@linux:~$ 

wolf@linux:~$ docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
wolf@linux:~$ 

However, when I open another terminal, it doesn't work anymore. I'm getting similar error as above.


Reboot should resolve the issue