azure-container-registrydocker-daemon

az acr login raises DOCKER_COMMAND_ERROR with message docker daemon not running


Windows 11 with wsl2 ubuntu-22.04.

In Windows Terminal I open a PowerShell window and start wsl with command:

wsl

Then I start the docker daemon in this window with the following command:

sudo dockerd

It prompts for the admin password, which I enter and then it starts the daemon.

Next I open a new PowerShell window in Windows Terminal, run wsl and run a container to verify everything is working. So far so good.

Now I want to login to Azure Container Registry with the following command:

az acr login -n {name_of_my_acr}

This returns the following error:

You may want to use 'az acr login -n {name_of_my_acr} --expose-token' to get an access token, 
which does not require Docker to be installed.
An error occurred: DOCKER_COMMAND_ERROR
error during connect: This error may indicate that the docker daemon is not running.: 
Get "http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/containers/json": 
open //./pipe/docker_engine: The system cannot find the file specified.

The error suggests the daemon is not running, but since I can run a container I assume the deamon is running - otherwise I would not be able to run a container either, right? What can I do to narrow down or resolve this issue?

Docker version info using docker -v command:

Docker version 20.10.12, build 20.10.12-0ubuntu4

Solution

  • An error occurred: DOCKER_COMMAND_ERROR error during connect: This error may indicate that the docker daemon is not running.: Get"http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/containers/json": open //./pipe/docker_engine: The system cannot find the file specified.

    The above error due to some times docker might be disabled from starting on boot or login.

    The following suggestion can be used:

    1. Open the Powershell and type dockerd which will start the daemon.

    2. Open the docker with run as administrator and run the command as below :

      C:\Program Files\Docker\Docker\DockerCli.exe -SwitchDaemon

    3. Check the version of WSL2, if it is older it might be a problem and then download the latest package WSL2 Linux kernel update package for x64-bit machines in the windows 11.

    Reference: Manual installation steps for older versions of WSL | Microsoft Docs