Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Servers, nginx and Docker

Docker CLI on Windows says the client must be run with elevated privileges

Errordocker: error during connect

Short answer

The docker client reached for the Windows daemon pipe and was refused or found nothing. The two documented fixes: add your account to the docker-users group and sign out and in again, or start Docker Desktop, which does not start by itself after install. Check which engine, Linux or Windows, the CLI talks to.

  • Applies to Docker Desktop 4.4x on Windows 11, PowerShell 7
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Run docker version in a normal PowerShell. If the Client block prints but the Server block does not, the CLI is fine and the daemon is the problem.

    docker version
    whoami /groups | findstr /i docker-users
  2. 2Match what you see, then jump to its fix

    1. 1Works in an Administrator terminal, fails in a normal one, and findstr prints nothingYour account is not in the docker-users groupFix
    2. 2docker version shows the Client block, then an error where the Server block should beDocker Desktop is not runningFix
    3. 3The error appears only after you used the Switch to Windows containers menu itemThe CLI is pointed at the Windows engine, which is not runningFix

What does the error look like?

  • docker: error during connect
  • the docker client must be run with elevated privileges to connect
  • docker commands work in an Administrator PowerShell but not in a normal one

Cause 1 of 3

Your account is not in the docker-users group

1Check

Docker Desktop adds the installing user to docker-users. Other users must be added by hand, and the group is needed for features such as Windows containers and Hyper-V.

whoami /groups | findstr /i docker-users

2Fix

Add the user from an administrator terminal, then sign out of Windows and sign in again so the new group applies.

net localgroup docker-users "YOUR-USER" /add

3Verify

Open a normal PowerShell after signing back in.

docker version

Confirmed by docs.docker.com

Did this fix it?

Cause 2 of 3

Docker Desktop is not running

1Check

Docker Desktop does not start automatically after installation. Without it there is no daemon to answer the CLI. On first launch it also needs the subscription agreement accepted.

Get-Process "Docker Desktop" -ErrorAction SilentlyContinue

2Fix

Start Docker Desktop by searching for it in the Start menu, accept the agreement if asked, and wait until it reports that the engine is running.

# Start menu > Docker Desktop

3Verify

The Server block appears.

docker version

Confirmed by docs.docker.com

Did this fix it?

Cause 3 of 3

The CLI is pointed at the Windows engine, which is not running

1Check

The Docker Desktop menu switches which daemon, Linux or Windows, the CLI talks to. Windows containers need the all-users install and a Pro or Enterprise edition.

docker version

2Fix

Switch back to Linux containers from the Docker Desktop tray menu, unless you really need Windows containers.

# Tray icon > Switch to Linux containers...

3Verify

docker version shows a Server block again.

docker version

Confirmed by docs.docker.com

Did this fix it?

How do I stop it coming back?

  • Add every developer account that needs Docker to docker-users when you set up a shared PC.
  • Start Docker Desktop before you open a terminal to run docker; it does not start by itself after install.
  • Leave Linux containers as the default engine unless a project needs Windows containers.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.