docker - 组合 docker-tag 和 shell-local 时打包器后处理器“未知工件类型”错误
问题描述
我有以下打包程序配置文件:
{
"builders":[
{
"type": "docker",
"image": "ubuntu:18.04",
"commit": true
}
],
"post-processors": [
[
{
"type": "shell-local",
"inline": ["$(aws ecr get-login --no-include-email --region us-east-2)"]
},
{
"type": "docker-tag",
"repository": "localhost/my_image",
"tag": "latest"
},
{
"type": "docker-tag",
"repository": "123456789.dkr.ecr.us-east-2.amazonaws.com/my_image",
"tag": "latest"
},
"docker-push"
]
]
}
这给了我以下错误
==> docker: Running post-processor: shell-local
==> docker (shell-local): Running local shell script: /var/folders/zh/wsr6wlx11v9703__rn7f3b080000gn/T/packer-shell756682313
==> docker (shell-local): WARNING! Using --password via the CLI is insecure. Use --password-stdin.
docker (shell-local): Login Succeeded
==> docker: Running post-processor: docker-tag
Build 'docker' errored: 1 error(s) occurred:
* Post-processor failed: Unknown artifact type:
Can only tag from Docker builder artifacts.
如果我删除 shell-local 后处理器,它会起作用。
我在 shell-local 后处理器中执行什么样的命令也没有关系。
我试图添加"keep_input_artifact": true
到 shell-local 后处理器,但这并没有改变任何东西。
如何在 docker-tag / docker-push 后处理器之前执行 shell-local 后处理器?
解决方案
我想到了。我必须将 shell-local 后处理器放在一个单独的列表中,即我必须将另一个列表添加到后处理器列表中,如下所示:
"post-processors": [
[
{
"type": "shell-local",
"inline": ["$(aws ecr get-login --no-include-email --region us-east-2)"]
}
],
[
{
"type": "docker-tag",
"repository": "localhost/my_image",
"tag": "latest"
},
{
"type": "docker-tag",
"repository": "123456789.dkr.ecr.us-east-2.amazonaws.com/my_image",
"tag": "latest"
},
"docker-push"
]
]
}
推荐阅读
- delphi - 如何将 ' 字符添加到 TINiFile 中的键和值
- or-tools - 使用ortools时如何获取cpsolver的变量和约束
- git - 如何在一个存储库下获得两个工作项目?
- r - 无法删除 data.frame 中的“,”(他们说“意外的数字常量。”)
- arrays - 传递一个指向 char 数组的指针,并在 C 中获取该数组的长度?
- node.js - 如何存储 axios 响应以便我可以在不同的功能中使用它
- vue.js - 是否可以在 Carousel 组件(BootstrapVue)的每个 b-carousel-slide 中使用 b-card?
- typescript - Typescript:创建一个方法,返回根据类确定的类型
- mysql - Sql count 按汽车品牌测试的车型数量
- laravel - 在 laravel 中显示网页的问题