我有以下packer配置文件:
{
"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本地后处理器中执行哪种命令也无关紧要。
我尝试将"keep_input_artifact": true添加到shell本地后处理器中,但这并没有改变任何事情。
如何在docker-tag / docker-push后处理器之前执行shell本地后处理器?
发布于 2020-02-03 18:14:08
我想通了。我必须将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"
]
]
}https://stackoverflow.com/questions/60036835
复制相似问题