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'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 manuely.
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
Create a cleaning policy (for example: 15 days after modification)
- Caveat: docker push
of the same hash is not modification
For each your registry (Nexus calls it "repository of type Docker"):
For removing old and / unused docker images you must use below command:
docker images purne
documents: https://docs.docker.com/engine/reference/commandline/image_prune/