-
Notifications
You must be signed in to change notification settings - Fork 548
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
question: does crane copy support multiarch image built with docker buildx? #1320
Comments
Can you share more about your manifest? ( You could also narrow down the issue with This might be an issue on ECR's side, but there's stuff we can try to find out. |
Hmm I just noticed it's getting the 400 on a |
thanks Jason for your help.
I actually don't understand why AWS triggers a HEAD request here. |
I am using crane copy to push to AWS ECR in another project successfully, but with images built with kaniko, and using IAM_role from AWS. |
It's odd that you're using Kaniko, because Kaniko uses the same underlying registry client code in Just in case it matters, could you make sure you're using the latest |
thanks for the explanation with HEAD. The other project using Kaniko has different auth indeed. Yes, the 400 on blob vs manifest is because on manifest occurs on a already existing image on the repo (pushed with docker buildx push) while here on the blob occurs on a different image name. The related aws repo should be already created, but I might add an extra step for that. So I ll check again my auth here. I though I already fixed it since I used to have a 401 and 403 before, Ok for getting the lastest crane. |
If the response from the HEAD is 404, that means it doesn't currently have the manifest, so we POST it. If it's 200, the registry has the manifest and we can skip uploading it. The registry API is based on content-addressed storage, so if the manifest changes at all -- including new source inputs producing new layers, or non-deterministic build inputs like the current time being different from previous builds -- a new manifest will be produced, which the registry has never seen before, the HEAD will return 404, and the manifest will be POSTed.
This might be the cause. Try |
as said earlier, I want to push to 2 different AWS ECR repo. for the first one, The get-login-password should use the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY variables set as gitlab variables. for the 2nd one, I have a script that generates a AWS Token based on OAuth2 credentials both solutions should be ok, isn't it? edit: apparently not so, I indeed see a 401 with |
I don't personally know enough about ECR's auth to know whether one should work and not the other. Which form of login produces the 401/400? Or do they both fail? |
Both should work, but in my case, none of them! I realized that crane is actually automatically/magically READING this file and use it for auth. Thus I don't need extra auth login. I also see that it is probably quite new since an older version of crane was not doing so. Please confirm whether reading .docker/config.json is an expected behavior. |
and for the first AWS, I still need to find the easiest way to use $AWS_ACCESS_KEY_ID and $AWS_SECRET_ACCESS_KEY with |
( I'll try to make docs describe this interaction better. I'm pretty sure this has been |
Here, I did NOT use |
In case you'd prefer to have the images built with kaniko: Using this in a job between my build & deploy stages enables me to copy the multi arch image in a single deploy job from gitlab to the appropriate ECR instance, even though kaniko itself builds single arch images only |
This issue is stale because it has been open for 90 days with no |
I am running into this same issue with a private docker registry: Docker Hub Image:
Mutate:
Result Image:
It seems like crane doesn't read all archs, it only reads the one you ask for or your localhost arch by default
|
I think the issue there is that Same with If you want to label every image in a multi-arch manifest, or get all the configs for a multi-arch manifest, you'll have to do some scripting with jq, xargs, etc., there's no single |
thank you for the quick reply 😄 So when I do copy/mutate multiple times with separate |
Let me know if there improvements we can make to docs or examples to make this clearer. edit to add:
says
It doesn't try to do anything like update |
I would like to use crane to make the deployment to different registries easier.
I have one gitlab repo, with one pipeline building a multiarch build to the Gitlab registry.
docker buildx build --platform "linux/amd64,linux/arm64" --build-arg REGISTRY=$TARGET_REGISTRY -t $TARGET_REGISTRY_WITH_NAMESPACE/$IMAGE_NAME:$TARGET_IMAGE_TAG --push .
and then, I would like to push this multarch image to AWS ECR registry (actually a job used twice with 2 different target registries).
the auth to the 2 registries (gitlab and aws) seems to be ok, but the crane cp always results with a 400:
2022/03/15 15:28:40 failed to copy index: HEAD <aws-registry>/v2/<aws-namespace>/manifests/sha256:fwed95...: unsupported status code 400
Any idea why this 400? Could be more a question for AWS support.
But at the first place, it is supposed to work ? Does crane cp support copying a multi arch image?
The text was updated successfully, but these errors were encountered: