如何删除私有registry中的image

1. Login to the container
docker exec -it registry sh


2. Define variables matching your container and container version:
export NAME="imagename"
export VERSION="imageversion"


3. Move to the the registry directory:
cd /var/lib/registry/docker/registry/v2


4. Delete files related to your hash:
find . | grep `ls ./repositories/$NAME/_manifests/tags/$VERSION/index/sha256`| xargs rm -rf $1


5. Delete manifests:
rm -rf ./repositories/$NAME/_manifests/tags/$VERSION


6. Logout
exit

posted @ 2021-12-29 17:47  Gdavid  阅读(110)  评论(0编辑  收藏  举报