无法从 Azure Devops 将 docker 图像推送到 AzureContainer Registry

Unable to Push docker image to AzureContainer Registry from Azure Devops

Docker 已创建有用的图像

成功构建188e6513fb56 成功标记 satyam-hello:20210210.24

我的 docker 推送图像任务不工作

推送引用存储库[.azurecr.io/.azurecr.io] 本地不存在标签为:.azurecr.io/.azurecr.io的图片 ##[错误]本地不存在带有标签的图像:.azurecr.io/.azurecr.io ##[错误]进程“/usr/bin/docker”失败,退出代码为 1

Docker 任务不存在 属性 azureSubscriptionEndpoint。参见 docker task document

如果您使用 Docker 任务将图像推送到 ACR。您需要创建一个 ACR service connection.

转到项目设置-->服务连接-->新服务连接-->Docker注册表-->Azure 容器Registry/Others。请参阅下面的屏幕截图。

如上错误所示,您还需要为 Docker 任务指定 repository 属性。请参阅以下示例:

- task: Docker@2
  displayName: push
  inputs:
    containerRegistry: ACR-ServiceConnection  #the ACR service connection created above
    repository: MyRepository #the repository in your ACR
    command: push

更新:

docker 任务没有 imageName 参数。如果图像是satyam-hello:20210210.24。您应该按如下方式配置 docker 任务:

- task: Docker@2
  displayName: push
  inputs:
    containerRegistry: ACR-ServiceConnection #$(SubscriptionEndpoint)
    repository: 'satyam-hello' #$(imageName)
    command: push
    tags: 20210210.24  #$(tags)