Skip to content

Docker push build cache error

When building an image and trying to store the image cache in the registry, like for example:

docker buildx build . --cache-to type=registry,ref=registry.services.k8s.true.nl/<project-name>/<repository-name>:cache
You can encounter an error that looks like this:
------
 > exporting cache to registry:
------
ERROR: failed to solve: error writing manifest blob: failed commit on ref "sha256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx": unexpected status from PUT request to https://***/v2/<project-name>/<repository-name>/manifests/buildcache: 404 Not Found
This can be fixed by adding the image-manifest=true option to the --cache-to arguments. For example:
docker buildx build . --cache-to type=registry,image-manifest=true,ref=registry.services.k8s.true.nl/<project-name>/<repository-name>:cache