【问题标题】:Problem pushing docker image from azure pipeline从 azure 管道推送 docker 映像的问题
【发布时间】:2022-08-15 03:34:35
【问题描述】:

我有一个 azure devops 管道。

trigger:
- master

resources:
- repo: self
variables:
  tag: \'$(Build.BuildId)\'
  ImageName: \'ngx-int-api:$(Build.BuildId)\'

stages:
- stage: Build
  displayName: Build image
  jobs:
  - job: Build
    displayName: Build
    pool:
      vmImage: ubuntu-latest
    steps:
    - task: Docker@2
      displayName: Build an image
      inputs:
        command: build
        arguments: --build-arg git_personal_token=ghp_MYTOKEN
        dockerfile: \'$(Build.SourcesDirectory)/Dockerfile\'
        imageName: \'$(ImageName)\'
        containerregistrytype: \'Container Registry\'
        dockerRegistryEndpoint: \'Docker Hub\'
        includeLatestTag: true
        useDefaultContext: false
        tags: |
          $(tag)
    - task: Docker@2
      displayName: Push image
      inputs:
        containerregistrytype: \'Container Registry\'
        dockerRegistryEndpoint: \'Docker Hub\'
        imageName: \'$(ImageName)\'
        repository: \'crooksey201/ngx-int-api\' #dockerhubAccountName/repoName
        command: push
        tags: |
          $(tag)

这可以很好地构建我的图像,但是在推送阶段,我得到了错误:

##[error]An image does not exist locally with the tag: crooksey201/ngx-int-api

在我刚刚得到的 docker 图像列表中:

REPOSITORY       TAG         IMAGE ID       CREATED                  SIZE
<none>           <none>      f705e0d37a95   Less than a second ago   1.76GB

这张图片没有我感到困惑的标签,因为我认为我已经在我的管道中正确指定了标签,有人能发现我的错误吗?

    标签: docker azure-devops azure-pipelines


    【解决方案1】:

    在您的示例中,任务 Docker@2 的一些输入是 not documented,而 imageName: 可能是 repository:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-05-13
      • 1970-01-01
      • 2019-09-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多