Closed ghost closed 2 years ago
This feature will be available in the upcoming release. Here is the example template to tag and push docker image to ECR Public:
// NOTES:
// Check following items before running the template:
// 1. `docker` is running locally
// 2. Appropriate variables are set under `default` profile in ` ~/.aws/credentials`
// 3. Change `registry_alias` and `registry_name` variables in this template with your appropriate values
variables {
registry_alias = "<your_registry_alias>"
registry_name = "<your_registry_name>"
}
source "docker" "ubuntu-bionic" {
image = "ubuntu:bionic"
commit = true
}
build {
name = "docker-push-ecr-public"
sources = [
"source.docker.ubuntu-bionic"
]
post-processors {
post-processor "docker-tag" {
repository = "public.ecr.aws/${var.registry_alias}/${var.registry_name}"
tags = ["latest"]
}
post-processor "docker-push" {
ecr_login = true
aws_profile = "default"
login_server = "https://public.ecr.aws/${var.registry_alias}/${var.registry_name}"
}
}
}
This issue was originally opened by @Laakso as hashicorp/packer#10948. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.
Description
Since AWS released their public container registry it would be nice that the packer image would be pushed there as well.
Use Case(s)
Push packer container image to ECR public container registry.