Installing Docker Desktop using local admin
TL;DR: If you installed Docker Desktop with a local admin account, you must manually add your (non-admin) user account to the docker-users
group. This is mentioned in the official docs, but is easy to miss.
Problem §
I have used local admin to install Docker Desktop. The installation worked fine, but docker
commands do not work. When everything is working, you should be able to run docker run hello-world
and a container will run that prints Hello from Docker!
. However, I get these errors:
Additionally, I noticed that the Docker Desktop service was not running. This would normally be indicated by the presence of Docker icon in the system tray. I tried running the Docker Desktop app, but nothing happened.
Fix §
The fix is mentioned in the official docs2:
If your administrator account is different to your user account, you must add the user to the docker-users group:
- Run Computer Management as an administrator.
- Navigate to Local Users and Groups > Groups > docker-users.
- Right-click to add the user to the group.
- Sign out and sign back in for the changes to take effect.
I followed those steps, and then after logging back in again, I was able to launch the Docker Desktop app. Then I was able to log in to Docker Desktop (which authenticates via the browser) and use containers as normal.
Verify §
Now if we run docker run hello-world
it works as expected:
All good!
Although both error messages say “the docker client must be run with elevated privileges to connect”, it is not helpful to run Docker Desktop as admin to try and fix this. While I found doing so enabled the Docker Desktop app to run (presumably since it was using the local admin account and so was part of the
docker-users
group), I was unable to login to Docker Desktop. My hypothesis is that, because the login goes via the browser, and the browser is run as a regular (non-admin) user account, it cannot tell the Docker Desktop app that the login was successful. ↩︎ ↩︎