Run docker without sudo

First add the group docker if it does not already exists.

sudo groupadd docker

then add the current user to the group

sudo usermod -aG docker $USER

then apply the changes

newgrp docker

if it still does not work it reboot the system. I had to restart the system for vscode to connect to docker using the docker extension