How to start docker-desktop as root

As the guide says in the section Launch docker desktop, start docker desktop with systemctl --user start docker-desktop.

But, how can I start docker-desktop as root? I need to use container with my gpu, so I have to run the container with sudo or as root. How can I run a container on docker-desktop as root? I tried the command sudo systemctl start docker-desktop, but it said that Failed to start docker.service: Unit not found. Or I tried just sudo docker run hello-world (just for an example), it said that docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?..

Could anybody help me? plz

some relative information about my device:

  • OS: kubuntu 20.04 LTS
  • Version of docker-desktop: 4.15.0-amd64

Have same question …
Too bad, the question is 6 months old without any solutions from Docker team.

This is a comunity forum, where questions are asked from the community and mainly answered from the community.

If you feel this should be a feature request or is actually a bug, feel free to raise an issue in the Github Project of Docker Desktop for Linux.

Background information about the topic:
Docker-Desktop uses a utility vm to run the docker engine. So running it as root or with sudo would not change what the utility vm is allowed to do. The docker engine always runs as root. Containers on the other hand depend on how it’s intended for a specific image. Some start as root and stay root, some start as root and exec the main application/service as unprivileged user, some start as unprivileged user right away. This is up to the image maintainer, and nothing the docker engine does.

So the real question is how to make the utility vm use the gpu of the host and how to pass the gpu from the utility vm to the container. I have no idea whether it’s possible or not.

I wonder why the OP didn’t use docker-ce where passing the gpu to a container works without much effort.

This is not true. root will have a different list of running containers than any other user.