构建 docker 镜像并直接使用它,无需推送到 azure dev ops

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

在天蓝色的管道中,我有两个步骤:

  • 第一步,构建Docker镜像(提供交叉编译环境)

  • 第二步是构建

    steps:
        - checkout: self
          clean: true
    
    - task: DockerInstaller@0
      displayName: Docker Installer
      inputs:
        dockerVersion: '17.09.0-ce'
        releaseType: stable
    
    - bash: |
        docker -t my_image -f path/to/Dockerfile .
      displayName: "Build docker image"
    
    - bash: |
        docker run -ti my_image <some_build_command>
      displayName: "Build application"
    

日志输出如下所示:

Resolving "my_image" using unqualified-search registries (/etc/containers/registries.conf)
Trying to pull docker.io/library/my_image:latest...
Trying to pull quay.io/my_image:latest...
Error: 2 errors occurred while pulling:
 * initializing source docker://my_image:latest: reading manifest latest in docker.io/library/my_image: errors:
denied: requested access to the resource is denied
unauthorized: authentication required

 * initializing source docker://quay.io/my_image:latest: reading manifest latest in quay.io/pm-linux-arm64: StatusCode: 404, <!doctype html>
<html lang=en>
<title>404 Not Foun...

我似乎工作人员忽略了我的 docker 图像。 在构建命令之前执行“docker images”时,它会输出 my_image 作为本地 docker 注册表的一部分

有人有想法吗?

azure azure-devops azure-pipelines
1个回答
0
投票

在 docker run 命令中添加“--pull never”解决了问题

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