[英]Error connecting to azure container registry using system assigned managed identity from a VM
I'm not able to connect to Azure Container registry from a VM with System Assigned Managed Identity Enabled.我无法从启用了系统分配托管标识的 VM 连接到 Azure 容器注册表。 The MI is assigned acrpush role on the ACR.
MI 被分配了 ACR 上的 acrpush 角色。
I'm following the link enter link description here我正在点击链接,在此处输入链接描述
az login --identity
--> works az login --identity
--> 有效
az acr login --name myContainerRegistry
--> fails with error az acr login --name myContainerRegistry
--> 失败并出现错误
An error occurred: DOCKER_COMMAND_ERROR
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/json: dial unix /var/run/docker.sock: connect: permission denied```
Not Sure why it was giving the above error.不确定为什么会出现上述错误。 The docker was in running status(Active), I checked it using
service docker status
command. docker 处于运行状态(活动),我使用
service docker status
命令检查了它。
But when I tried the next day again az acr login
command, it worked like a charm.但是当我第二天再次尝试
az acr login
命令时,它就像一个魅力。
After login I was able to push the image from GitLab Runner VM to ACR using Managed Identity by following the below steps.登录后,我可以按照以下步骤使用托管身份将图像从 GitLab Runner VM 推送到 ACR。
The 3rd step to tag the image is important, without tagging we get authentication required error, even when the Managed Identity is assigned acrpush role标记图像的第 3 步很重要,如果没有标记,我们会收到需要身份验证的错误,即使托管身份被分配了 acrpush角色
1) az login --identity
2) az acr login --name <mycontainerregistry>
3) docker image tag <image>:version mycontainerregistry.azurecr.io/<image:version>
4) docker push mycontainerregistry.azurecr.io/<image>:<version>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.