I'm using Sonatype Nexus as a Docker Registry and after a while, it got really big (new image with every CI build and some old projects).
I tried using "Purge unused docker manifests and images" task, but it doesn't seem to do anything.
I remove the old docker images manually.
get nexus-cli
wget https://s3.eu-west-2.amazonaws.com/nexus-cli/1.0.0-beta/linux/nexus-cli
chmod +x nexus-cli
configure host
./nexus-cli configure
show images
./nexus-cli image ls
keep the latest 5 images
./nexus-cli image delete -name mlabouardy/nginx -keep 5
A clean script
image_file=image.txt CLI_HOME=/data/nexus3 KEEP_VERSION_NUM=5 $CLI_HOME/nexus-cli image ls > $image_file sed -i '$d' $image_file cat $image_file | while read line do echo "start clean image: $line" $CLI_HOME/nexus-cli image delete -name $line -keep $KEEP_VERSION_NUM done
create create docker - delete unsued manifests and images task
create create admin -compact blob store task
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With