我正在Ubuntu 16.04上使用v2版本。我的配置文件看起来像这样-
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
我正在运行以下命令序列
# 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
从本地删除图像
# 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
获取摘要
# 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)}'
删除图片
# curl -v -H "Accept: application/vnd.docker.distribution.manifest.v2+json" -X DELETE localhost:5000/v2/busybox/manifests/sha256:5e8e0509e829bb8f990249135a36e81a3ecbe94294e7a185cc14616e5fad96bd
清理blob(运行垃圾收集器)
# docker exec registry bin/registry garbage-collect /etc/docker/registry/config.yml
删除后,要拉出新的busybox图片
# 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说fslayer已经存在
# 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
删除后,我必须重新启动注册表。
重新启动注册表后,相同的忙碌框拉标签和推图像工作正常。
我不明白为什么每次都必须重新启动注册表。为什么“推忙箱”图像显示fslayers已经存在,并且成功执行并从注册表中拉出失败。
请您告诉您删除图像而不必每次都重新启动注册表