打包机后处理器“;“未知工件类型”;合并docker标记和shell local时出错
我有以下打包机配置文件:打包机后处理器“;“未知工件类型”;合并docker标记和shell local时出错,docker,packer,Docker,Packer,我有以下打包机配置文件: { "builders":[ { "type": "docker", "image": "ubuntu:18.04", "commit": true } ], "post-processors": [ [ { "type": "shell-local", "inline": ["$(aws ecr get-login --no-include-email
{
"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本地后处理器,它就会工作
在shell本地后处理器中执行何种命令也无关紧要
我试图向shell本地后处理器添加“keep_input_artifact”:true
,但这并没有改变任何事情
如何在docker标记/docker推送后处理器之前执行shell本地后处理器?我已经解决了。我必须将shell本地后处理器放在一个单独的列表中,即我必须在后处理器列表中添加另一个列表,如下所示:
"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"
]
]
}