0
我的CI将图像推送到码头注册表下的一个标记下。我有一个脚本定期清理旧的未用户映像。它只是遍历标签内的摘要并在注册表API上调用DELETE(遍历注册表文件系统上的文件)。Docker注册表 - 从文件系统中删除清单
dir="${REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY}/docker/registry/v2/repositories/test/_manifests/tags/5.3/index/sha256/"
oldManifests=$(ls -t $dir | tail -n +2 ; done)
for hash in $oldManifests
do
curl -L -X DELETE http://localhost:5000/v2/test/manifests/sha256:$hash
done
/bin/registry garbage-collect /etc/docker/registry/config.yml
后/垃圾收集所有的斑点被删除,但不是在_manifests /标签/ 5.3 /索引/ SHA256目录。为什么?手动删除它是否安全?
我在Docker Hub中创建了一个Python脚本和一个Docker镜像:https://github.com/ricardobranco777/clean_registry –