在Azure管道上无法重命名docker映像

问题描述 投票:0回答:1

我尝试使用此任务重命名构建映像:

steps:
- task: Docker@0
  displayName: 'Run a Docker TAG rename'
  inputs:
    containerregistrytype: 'Container Registry'
    dockerRegistryConnection: 'docker hub'
    action: 'Run a Docker command'
    customCommand: 'tag  azuretp:latest (my docker hub account)/dockerhub:myfirstpush'

但失败并显示错误:

"C:\Program Files\Docker\docker.exe" tag azuretp:latest ***/dockerhub:myfirstpush
Error response from daemon: No such image: azuretp:latest

在本地运行,我可以使用命令将其重命名:

docker tag trfoutwsrv:dev (my docker hub account)/dockerhub:myfirstpush

在Azure Pipeline Services,映像名称随生成而变化。我已经尝试过azuretp:{Build.BuildNumber},但是该变量在任务运行时不存在。

目标是重命名映像,以便可以将其推送到我的Docker Hub存储库中。我已经将原始任务拆分为重命名然后进行推送,但是现在我仍然无法重命名。

azure docker azure-devops azure-pipelines azure-pipelines-build-task
1个回答
0
投票

在这种情况下,解决方案是使用azuretp:$(Build.BuilNumber)

© www.soinside.com 2019 - 2024. All rights reserved.