Many of us, are using as a repository to publish . Typically we build images tagged with the (or using ideally) after change automatically in and we push them to registry. As result there are many “unneeded” & “old” images that in our case take significant amount of disk space. Nexus Docker Images commit hash semver SCM CI I looked around the graphical interface of and there’s apparently nothing to remove several Docker images at the same time. Or even, a scheduled task to clean up old hosted Docker images, and to also clean up layers which are no longer used by any hosted images. Nexus So I have come up with a simple bash script which uses to purge images and keep the last and delete all other. But, is there a better solution ? YES ! I built a Docker Registry API Docker X images Nexus CLI To install , find the appropriate package for your system and download it. For linux: Nexus CLI wget https://s3.eu-west-2.amazonaws.com/nexus-cli/1.0.0-beta/linux/nexus-cli After downloading . Add the execution permission to the binary: Nexus CLI chmod +x nexus-cli Note: For make sure that binary is available on the . contains instructions for setting the on . Windows nexus-cli PATH This page PATH Windows After installing, verify the installation worked, by opening a new terminal session and checking if is available : nexus-cli Once done, configure the credentials: Nexus nexus-cli configure Through the Nexus CLI will prompt you for four pieces of information. The and are your account credentials. & name. nexus-cli configure, Username Password Nexus Hostname Docker repository That should be it. Try out the following command from your cmd prompt and, if you have any images, you should see them listed nexus-cli image ls Display image tags: nexus-cli image tags -name IMAGE_NAME Image description: nexus-cli image info -name IMAGE_NAME -tag TAG To remove a specific image: nexus-cli image delete -name IMAGE_NAME -tag TAG To keep only the last X images and delete all other: nexus-cli image delete -name IMAGE_NAME -keep X That’s it ! Let’s go back to : Nexus Dashboard As you can see, Nexus kept only the last 4 images and deleted the others. The CLI is still in its early stages, so you are welcome to contribute to the project in . Github