Azure CLI cannot conect to the Docker Daemon

11/14/2020

I'm new with Kubernetes and Azure. I want to Deply my application and I am floowing the microsoft tutorial about kubernetes. At first I have created the resouce group and ACR instance. When I try to login in ACR console show this error: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

I'm using azure cli localy and I have docker running.

-- Adrian Gago
azure
azure-cli
docker
docker-daemon
kubernetes

2 Answers

12/23/2021

You can try below options to connect ACR :

run az acr login first with the --expose-token parameter. This option exposes an access token instead of logging in through the Docker CLI.

az acr login --name <acrName> --expose-token

Output displays the access token, abbreviated here:

{
  "accessToken": "eyJhbGciOiJSUzI1NiIs[...]24V7wA",
  "loginServer": "myregistry.azurecr.io"
}

For registry authentication, we recommend that you store the token credential in a safe location and follow recommended practices to manage docker login credentials. For example, store the token value in an environment variable:

TOKEN=$(az acr login --name <acrName> --expose-token --output tsv --query accessToken)

Then, run docker login, passing 00000000-0000-0000-0000-000000000000 as the username and using the access token as password:

docker login myregistry.azurecr.io --username 00000000-0000-0000-0000-000000000000 --password $TOKEN

you will get the below promt if you follow the above method :

WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Login Succeeded
-- Ghansham Mahajan
Source: StackOverflow

11/14/2020

Seems your Docker Desktop is not running. Make sure you installed the Docker for Desktop on your machine and start it if not. You should be good once you start.

-- Sajeetharan
Source: StackOverflow