Docker Community Forums

Share and learn in the Docker community.

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

docker

(Nikhil088) #1

Hi

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

    version: 0.1
    log:
      fields:
        service: registry
    storage:
      cache:
        blobdescriptor: inmemory
      filesystem:
        rootdirectory: /var/lib/registry
      delete:
        enabled: true
    http:
  addr: :5000
  headers:
    X-Content-Type-Options: [nosniff]
health:
  storagedriver:
    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.