I try to execute docker run hello-world on a debian bullseye machine where I do not have root user rights, but where I can use sudo.
I installed docker (v19.03.13) with sudo according to the docker documentation. docker can be started using sudo systemctl start docker and according to sudo systemctl status docker the service is running as expected. As well sudo systemctl status docker.socket looks normal.
I found a docker.sock file at /var/run/.
Now, when try to run docker run hello-world (no sudo!) I get an error message:
docker: Cannot connect to the Docker daemon at unix:///home/<myuser>/.docker/run/docker.sock. Is the docker daemon running?.
So as it seems, the docker service is looking in the wrong directory for docker.sock.
The following things I tried already, but didn't work:
sudo systemctl stop/start/restart docker(standard answer I found in discussions about this problem)- added my user to docker group:
sudo usermod -aG docker $USER. Commandless /etc/group | grep dockeryieldsdocker:x:999:myUserName ls -la /var/run/docker.sock-->srw-rw---- 1 root docker 0 Jul 17 17:48 /var/run/docker.sock(suggested by https://unix.stackexchange.com/a/279785/335075)unset DOCKER_HOST(e.g. https://stackoverflow.com/a/69674630/1552080).sudo mount -t cgroup -o none,name=systemd cgroup /sys/fs/cgroup/system(this worked once, but not a second time after I logged out an in again)
What I can do is run sudo docker run hello-world.