Can't use docker as none root user

Hello,

I’ve new installed docker on a actual Debian 12 machine after https://docs.docker.com/engine/install/debian. As root user I can start the hello-world example without problem. As none root user not.

When I install deocker desktop after https://docs.docker.com/desktop/setup/install/linux/debian/ is the command blocked and I must kill it.

Without docker desktop I become the error:

tester@a1:~$ docker run hello-world
docker: Cannot connect to the Docker daemon at unix:///home/bm/.docker/desktop/docker.sock. Is the docker daemon running?

The user itself is add to the group:

root@a1:~# cat /etc/group  | grep docker
docker:x:994:tester

Installed docker packages:

root@a1:~# dpkg -l | grep docker
ii  docker-buildx-plugin                    0.22.0-1~debian.12~bookworm         amd64        Docker Buildx cli plugin.
ii  docker-ce                               5:28.0.2-1~debian.12~bookworm       amd64        Docker: the open-source application container engine
ii  docker-ce-cli                           5:28.0.2-1~debian.12~bookworm       amd64        Docker CLI: the open-source application container engine
ii  docker-ce-rootless-extras               5:28.0.2-1~debian.12~bookworm       amd64        Rootless support for Docker.
ii  docker-compose                          1.29.2-3                            all          define and run multi-container Docker applications with YAML
ii  docker-compose-plugin                   2.34.0-1~debian.12~bookworm         amd64        Docker Compose (V2) plugin for the Docker CLI.
ii  python3-docker                          5.0.3-1                             all          Python 3 wrapper to access docker.io's control socket
ii  python3-dockerpty                       0.4.1-4                             all          Pseudo-tty handler for docker Python client (Python 3.x)

Docker is active:

root@a1:~# systemctl is-active docker
active

Have everyone an idee to solve this problem? Please without sudo. sudo is not allowed, than I can work directly as root.

docker desktop is also not a alternative solution. It use KVM VM and I have running VirtualBox. Booth together not working.

Thanks for our help,
Bernd

Open the link you shared, scroll to the bottom until you reach the “Next Steps” section, follow the link and you will find the necessary instructions to allow an unprivileged user to interact with the docker backend using the docker.sock.

Since you want to run docker-ce, make sure to uninstall Docker Desktop again.

OK, I have read this aggain.

The group was generated during the installation. I have added only the user to the group.

I’ve deinstalled the docker desktop.

The first start with sudo is not working on my machine. This have no sudo access. I have change the user to root with “su -”.

The .docker directory exists for the user and have the correct rights.

tester@a1:~$ ls -la .docker
insgesamt 40
drwxr-xr-x  8 tester tester 4096 20. Mär 08:19 .
drwx------ 36 tester tester 4096 20. Mär 07:47 ..
drwx------ 5 tester tester 4096 20. Mär 08:19 buildx
drwx------ 2 tester tester 4096 19. Mär 00:01 cli-plugins
-rw-r--r-- 1 tester tester   78 20. Mär 08:19 config.json
drwxr-xr-x 3 tester tester 4096 19. Mär 00:01 contexts
-rw-r--r-- 1 tester tester  124 20. Mär 08:19 daemon.json
drwxr-xr-x 6 tester tester 4096 20. Mär 08:31 desktop
drwx------ 2 tester tester 4096 19. Mär 00:01 desktop-build
drwx------ 4 tester tester 4096 19. Mär 00:01 mutagen

Oh, here I see contents from the docker desktop. Now I have delete the complete directory and now I can run the “docker run hello-world” command as non root user.

Now is also the entry of the sockets in the user directory remove:

tester@a1:~$ docker context ls
NAME        DESCRIPTION                               DOCKER ENDPOINT               ERROR
default *   Current DOCKER_HOST based configuration   unix:///var/run/docker.sock  

OK, I think this directory comes frome some install tries. Is this directory used for the docker without docker desktop? When yes, is it enough if I create it manually or did I need some content in this directorie?

Thanks for youre help :slight_smile:
Bernd

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.