Add the docker group if it doesn’t already exist:
sudo groupadd docker
Add the connected user “$USER” to the docker group. Change the user name to match your preferred user if you do not want to use your current user:
sudo gpasswd -a $USER docker
sudo groupadd docker
sudo gpasswd -a $USER docker