Issue with Deleting Images from Registry via GitLab Using Tag Instead of Digest

I’m currently facing an issue with GitLab’s Docker Registry integration where the deletion of Docker images is attempted using tags instead of the digest, leading to failures. Specifically, when GitLab attempts to delete an image from the registry, it uses the image tag in the request, which results in an error. My setup involves a separate host for the Docker Registry, which is integrated with GitLab for managing Docker images. The registry is configured to allow deletions, and everything works flawlessly except for the image deletion part.

Here’s a sanitized version of my configurations:

GitLab (gitlab.rb) is set up to enable and point to the Docker Registry:

gitlab_rails['registry_enabled'] = true
gitlab_rails['registry_host'] = ""
gitlab_rails['registry_api_url'] = ""

Docker Registry is deployed using the following docker-compose.yml on a separate machine:

version: '3.8'
    image: registry:latest
      - "5000:5000"
      - /var/docker/gitlab-registry:/var/lib/registry

When GitLab tries to delete an image, the registry logs this request:

[28/Mar/2024:14:01:49 +0000] "DELETE /v2/some-awesome-repo/manifests/437 HTTP/1.0" 400 98 "" "GitLab/16.10.1-ee"

And reports an error:

level=error msg="response completed with error" err.code="digest invalid" err.message="provided digest did not match uploaded content" go.version=go1.20.8 http.request.method=DELETE http.request.remoteaddr= http.request.uri="/v2/some-awesome-repo/manifests/437"

The error indicates a mismatch because the deletion request was made with a tag (437) instead of the expected digest.

Interestingly, I was able to delete the image manually using Postman with the correct digest:


This issue seems to be specific to how GitLab constructs the deletion request, as manual deletion with the correct digest works as expected. I’m looking for guidance on how to resolve this, ensuring GitLab correctly uses digests instead of tags for image deletion requests. Any insights or workarounds from the community would be greatly appreciated.

1 Like

Same problem.

Same here, sameersbn/gitlab:16.10.2

I was experiencing the issue myself - a bit more digging revealed that in my setup, I was still using the upstream (docker) registry:2.8 image.

With gitlab 16.x the support for external registries was deprecated by gitlab Deprecations and removals by version | GitLab

See also the notice at: GitLab container registry administration | GitLab

Following some discussion around the internet, the suggested way forward is to move/migrate to the official registry

For reference the official migration guide: GitLab container registry administration | GitLab

People have had success switching their external docker registry to the gitlab build registry at

See: problem deleting image or tag 16.6.1 · Issue #2867 · sameersbn/docker-gitlab · GitHub