Docker Community Forums

Share and learn in the Docker community.

After deletion image from docker registry can't push new image to registry


I am using v2 version on ubuntu 16.04.  My Config file look like this-

    version: 0.1
        service: registry
        blobdescriptor: inmemory
        rootdirectory: /var/lib/registry
        enabled: true
  addr: :5000
    X-Content-Type-Options: [nosniff]
    enabled: true
    interval: 10s
    threshold: 3

i am running the following sequence of commands

# docker pull busybox
Using default tag: latest
latest: Pulling from library/busybox
8c5a7da1afbc: Pull complete
Digest: sha256:cb63aa0641a885f54de20f61d152187419e8f6b159ed11a251a09d115fdff9bd
Status: Downloaded newer image for busybox:latest

# docker tag busybox localhost:5000/busybox:1.0.0

# docker push localhost:5000/busybox:1.0.0
The push refers to repository [localhost:5000/busybox]
f9d9e4e6e2f0: Pushed
1.0.0: digest: sha256:5e8e0509e829bb8f990249135a36e81a3ecbe94294e7a185cc14616e5fad96bd size: 527

Delete images from local

# docker rmi e1ddd7948a1c -f
Untagged: localhost:5000/busybox:1.0.0
Untagged: localhost:5000/busybox@sha256:5e8e0509e829bb8f990249135a36e81a3ecbe94294e7a185cc14616e5fad96bd
Untagged: busybox:latest
Untagged: busybox@sha256:cb63aa0641a885f54de20f61d152187419e8f6b159ed11a251a09d115fdff9bd
Deleted: sha256:e1ddd7948a1c31709a23cc5b7dfe96e55fc364f90e1cebcde0773a1b5a30dcda
Deleted: sha256:f9d9e4e6e2f0689cd752390e14ade48b0ec6f2a488a05af5ab2f9ccaf54c299d

Get Digest

# curl -v --silent -H "Accept: application/vnd.docker.distribution.manifest.v2+json" -X GET localhost:5000/v2/busybox/manifests/1.0.0 2>&1 | grep Docker-Content-Digest | awk '{print ($3)}'

Delete image

# curl -v -H "Accept: application/vnd.docker.distribution.manifest.v2+json" -X DELETE localhost:5000/v2/busybox/manifests/sha256:5e8e0509e829bb8f990249135a36e81a3ecbe94294e7a185cc14616e5fad96bd

Clean blobs(Run garbage collector)

# docker exec registry bin/registry garbage-collect /etc/docker/registry/config.yml

After deletion New busybox image to pull

# docker pull busybox

# docker tag busybox localhost:5000/busybox:1.0.0

# docker push localhost:5000/busybox:1.0.0
The push refers to repository [localhost:5000/busybox]
f9d9e4e6e2f0: Layer already exists
1.0.0: digest: sha256:5e8e0509e829bb8f990249135a36e81a3ecbe94294e7a185cc14616e5fad96bd size: 527

Docker push says fslayer already exist

# docker rmi e1ddd7948a1c -f

docker pull localhost:5000/busybox:1.0.0
Error response from daemon: manifest for localhost:5000/busybox:1.0.0 not found

# curl -v --silent -H "Accept: application/vnd.docker.distribution.manifest.v2+json" -X GET localhost:5000/v2/busybox/manifests/1.0.0

It gives 404 Not Found

I have to restart registry after delete.

After restarting registry same busy box pull tag and push images work fine.

I don’t understand why i have to restart registry every time .Why Push busybox image shows fslayers already exist and give success and pull fails from registry.

Please can you tell delete images without restarting the registry every time.

Get the same issues, anyone know how to fix it?

I am seeing the same problem.
Is there a way to clean this up without a registry restart?
Stopping everything that pushes to my registry would be a major pain.

I get the same issue :frowning:

After much research, there is no current method to remove the catalog entries fully via API only.

The v2 registry doesn’t allow deleting only certain tags from an image

This means that the entire image is deleted. Deletion of tags is in an open PR for a future version of the Registry (

What this means in regards to this question is that the proper method is to delete the image from the repo list is exactly as you assumed. Remove it from disk. (Such as rm -r v2/repositories/myimage where myimage is the image name that you deleted via API.)

It will then be removed from the repo list in _catalog and you’re finished with your deletion process. There is no need to restart anything like another answer mentioned.

When the ability to delete specific tags from the registry is added, then this procedure will change. For now it’s all or nothing.