Comments (5)
Hi @gdrapp,
In the given snippet, the login_server
argument is missing https://
and repository
name. Please add https://
and the repo
name to the login_server
argument in your post-processor
and everything should work fine.
Example:
post-processor "docker-push" {
ecr_login = true
aws_profile = "default"
login_server = "https://317215053986.dkr.ecr.us-east-2.amazonaws.com/<YOUR_PRIVATE_REPO_NAME>"
}
Full example template:
packer {
required_plugins {
docker = {
version = ">= 1.0.7"
source = "github.com/hashicorp/docker"
}
}
}
source "docker" "ubuntu-bionic" {
image = "ubuntu:bionic"
commit = true
}
build {
name = "docker-push-ecr-private"
sources = [
"source.docker.ubuntu-bionic"
]
post-processors {
post-processor "docker-tag" {
repository = "746700064644.dkr.ecr.us-east-1.amazonaws.com/private_dev_hc_pkr_dkr_test_1"
tags = ["latest"]
}
post-processor "docker-push" {
ecr_login = true
aws_profile = "default"
login_server = "https://746700064644.dkr.ecr.us-east-1.amazonaws.com/private_dev_hc_pkr_dkr_test_1"
}
}
}
This should fix the problem otherwise feel free to reach out!
Thanks!
from packer-plugin-docker.
Hi @gdrapp,
In the given snippet, the
login_server
argument is missinghttps://
andrepository
name. Please addhttps://
and therepo
name to thelogin_server
argument in yourpost-processor
and everything should work fine.Example:
post-processor "docker-push" { ecr_login = true aws_profile = "default" login_server = "https://317215053986.dkr.ecr.us-east-2.amazonaws.com/<YOUR_PRIVATE_REPO_NAME>" }Full example template:
packer { required_plugins { docker = { version = ">= 1.0.7" source = "github.com/hashicorp/docker" } } } source "docker" "ubuntu-bionic" { image = "ubuntu:bionic" commit = true } build { name = "docker-push-ecr-private" sources = [ "source.docker.ubuntu-bionic" ] post-processors { post-processor "docker-tag" { repository = "746700064644.dkr.ecr.us-east-1.amazonaws.com/private_dev_hc_pkr_dkr_test_1" tags = ["latest"] } post-processor "docker-push" { ecr_login = true aws_profile = "default" login_server = "https://746700064644.dkr.ecr.us-east-1.amazonaws.com/private_dev_hc_pkr_dkr_test_1" } } }This should fix the problem otherwise feel free to reach out!
Thanks!
isn't this is a breaking change?
from packer-plugin-docker.
Another Interesting case for me.
When I use private repo from us-east-1
like xxxxxxxxxxxx.dkr.ecr.us-east-1.amazonaws.com
Sample Source Code:
variable "registry" {
type = string
default = "xxxxxxxxxxxx.dkr.ecr.us-east-1.amazonaws.com"
}
source "docker" "base" {
image = "python:3.9-alpine"
commit = true
changes = [
"ENTRYPOINT /bin/bash",
"ENV BASH_ENV /home/gitlab/.bashrc",
"USER gitlab"
]
run_command = var.run_cmd
}
build {
sources = ["source.docker.base"]
provisioner "ansible" {
playbook_file = "prepare.yml"
user = "root"
}
provisioner "ansible" {
playbook_file = "main.yml"
user = "gitlab"
galaxy_file = "requirements.yml"
galaxy_force_install = true
extra_arguments = ["--extra-vars", "target=all"]
}
post-processors {
post-processor "docker-tag" {
repository = local.repo
tags = [formatdate("DDMMMYYYYhhmm", timestamp()), "latest"]
}
post-processor "docker-push" {
ecr_login = true
login_server = var.registry
}
}
}
Docker push works fine
But when I use another region like eu-west-3
like xxxxxxxx.dkr.ecr.eu-west-3.amazonaws.com
docker push fails with same error.
from packer-plugin-docker.
Hi, @axway-dpal and @gdrapp. We have fixed the bug related to this in v1.0.8
. Please update the plugin and everything should work fine as it used to be (aka no need to prefix the login_server
value with https://
!
Please feel free to reopen this issue, if you have questions or facing any issues.
Thanks for the patience!
from packer-plugin-docker.
Thanks a lot @devashish-patel, I will try it asap.
from packer-plugin-docker.
Related Issues (20)
- Parallel Docker pushes still failing due to credentials being removed HOT 3
- ECR Login fails in Packer 1.8.3 HOT 5
- No meaningful error even in debug mode when Docker Desktop (WSL2) is not running HOT 2
- /bin/sh: 1: /home/ubuntu/packer/script_2501.sh: Permission denied
- Unable to push an image to ECR HOT 6
- simple docker build changing CMD and ENTRYPOINT of resulting image HOT 2
- Packer should remove /packer-files mount point
- PowerShell at Windows container ignores errors
- Building images in parallel and pushing them to Docker Hub results in premature logout HOT 1
- docker-push doesn't push to Private repository. HOT 4
- HCL2 example of "windows_container": true uses ubuntu image HOT 2
- Packer's docker plugin metadata change for Env does require equal sign and cannot extend env vars in hcl2 variant language
- Packer docker builder reseting ENTRYPOINT and CMD
- error with provisioning scripts in docker HOT 4
- Question template in the issue is out of date HOT 1
- Docker-push post processer ecr_login assume role support
- Build docker image in parallel and credentials are removed before all images are push to ECR HOT 2
- Workaround for #8120: "Unable to use packer with distroless base images"
- Support `--platform` docker CLI argument to target the image architecture to be produced. HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from packer-plugin-docker.