[英]Docker login to Azure Container Registry by Service Principle
I've created a service principle with AcrPush role assigned.我创建了一个分配了 AcrPush 角色的服务原则。 But when I access the container registry from docker it ask me user name and password.但是当我从 docker 访问容器注册表时,它会询问我用户名和密码。 I've never set the user name and password, how can I configure the docker to user the service principle?我从来没有设置过用户名和密码,如何配置docker来使用服务原理?
You do not have to set the username and password as it is already there in the container registry.您不必设置用户名和密码,因为它已经存在于容器注册表中。 In the container registry, you can enable the admin mode, and that is where you get your credentials from.在容器注册表中,您可以启用管理员模式,这就是您获取凭据的地方。
docker login myregistry.azurecr.io
Enter the username and password from the portal and it should work.从门户输入用户名和密码,它应该可以工作。
With service principal if properly created, you can do the following:如果正确创建了服务主体,您可以执行以下操作:
docker login myregistry.azurecr.io --username $SP_APP_ID --password $SP_PASSWD
For your issue, you use the service principal for the ACR with the role AcrPush
to push the images.对于您的问题,您使用具有AcrPush
角色的 ACR 的服务主体来推送图像。 The username and the password are that appId and password of the service principal, but you need to take care that the password is only displayed once when the service principal is created.用户名和密码是服务主体的 appId 和密码,但您需要注意密码仅在创建服务主体时显示一次。 If you forget the password, you need to reset it.如果忘记密码,则需要重新设置。 So the docker login would be like this:所以 docker 登录将是这样的:
docker login youracr.azurecr.io -u app_id -p app_password
In addition to the answer from @kgalic, you can also do the following: You didn't specify as to where you're executing the docker login command, but assumingyou have access to the Azure CLI and appropriate credentials, you can log into your azure container registry via az acr login --name <acrName>
.除了@kgalic 的回答之外,您还可以执行以下操作:您没有指定执行docker登录命令的位置,但假设您可以访问 Azure CLI 和适当的凭据,您可以登录到您的azure 容器注册表通过az acr login --name <acrName>
。 This will flow the ACR credentials down to docker so that you don't need to execute a separate docker login
这会将 ACR 凭据向下传递到 docker,因此您无需执行单独的docker login
See the following for more information: https://docs.microsoft.com/en-us/azure/container-registry/container-registry-authentication有关详细信息,请参阅以下内容: https://docs.microsoft.com/en-us/azure/container-registry/container-registry-authentication
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.