Skip to content
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

400 Bad request when building images with registry cache to ECR #1118

Closed
angonz opened this issue Sep 3, 2024 · 1 comment
Closed

400 Bad request when building images with registry cache to ECR #1118

angonz opened this issue Sep 3, 2024 · 1 comment

Comments

@angonz
Copy link
Contributor

angonz commented Sep 3, 2024

Bug description
When building images with registry cache, and when the cache is in AWS' ECR, building results in 400 Bad request error.

------
 > importing cache manifest from 2xxxxxxx4.dkr.ecr.us-east-1.amazonaws.com/myrepo/openedx:202409032122-cache:
------
------
 > exporting cache to registry:
------
error: failed to solve: rpc error: code = Unknown desc = error writing manifest blob: failed commit on ref "sha256:dbddfa9dc32dd219457de9c9b1534f667024da6e36e5a085f7f52540fc9ef9af": unexpected status from PUT request to https://2xxxxxxx4.dkr.ecr.us-east-1.amazonaws.com/v2/myrepo/openedx/manifests/202409032122-cache: 400 Bad Request
Error: Command failed with status 1: docker buildx build --tag=2xxxxxxx4.dkr.ecr.us-east-1.amazonaws.com/myrepo/openedx:202409032122 --output=type=docker --builder=container --cache-from=type=registry,ref=2xxxxxxx4.dkr.ecr.us-east-1.amazonaws.com/myrepo/openedx:202409032122-cache --cache-to=type=registry,mode=max,ref=2xxxxxxx4.dkr.ecr.us-east-1.amazonaws.com/myrepo/openedx:202409032122-cache /home/myuser/mytutorroot/env/build/openedx
Error building openedx

How to reproduce

  • Create an ECR registry in AWS
  • Declare the registry url in the DOCKER_REGISTRY variable
  • Log in to ECR
  • Run tutor images build openedx --cache-to-registry

Environment

Tested with Tutor 17.0.6

Additional context

As per this document, adding image-manifest=true context to the docker buildx command fixed the issue.

The new context key introduced in Buildkit 0.12 here is image-manifest. Setting this key’s value to true lets you now store an OCI-compatible version of a remote cache in the registry.

If it doesn't break the official repos (which I cannot test), I would like to add this key to the image build args.

@angonz
Copy link
Contributor Author

angonz commented Sep 4, 2024

I have just hardcoded the image-manifest=true to the build command in PR #1119. Please check if it doesn't impact negatively in the official, public Docker registry.
Another option would be to do it under another option, like --cache-to-registry-oci or similar.

@DawoudSheraz DawoudSheraz closed this as not planned Won't fix, can't repro, duplicate, stale Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Won't fix
Development

Successfully merging a pull request may close this issue.

2 participants