Bitbucket管道使用上一步本地构建映像 [英] Bitbucket pipeline use locally built image from previous step

查看:28
本文介绍了Bitbucket管道使用上一步本地构建映像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我要在一个管道步骤中构建停靠器映像,则在接下来的步骤中使用它-我该如何执行此操作?

例如

default:
    - step:
        name: Build
        image: 
        script:
          - docker build -t imagename:local .
          - docker images
    - step:
        name: Deploy
        image: 
        script:
          - docker images

在此示例中,图像显示在第一步中,而不是第二步

推荐答案

您可以将Docker保存/加载与位桶项目结合使用。

示例:

- step:
  name: Build docker image
  script:
    - docker build -t "repo/imagename" .
    - docker save --output tmp-image.docker repo/imagename
  artifacts:
    - tmp-image.docker
- step:
  name: Deploy to Test
  deployment: test
  script:
   - docker load --input ./tmp-image.docker
   - docker images

来源:Link

这篇关于Bitbucket管道使用上一步本地构建映像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆