Nexus OSS | Solving the problem of cleaning up the Docker repository

Habib Guliyev
3 min readApr 15, 2021

Hi guys. As we know, there is a known issue with the Nexus OOS — the Docker repository cleanup process.
The problem looks like this:

  1. Delete the docker image from the repository via web-ui / http-api / nexus-cli, but the free space does not change
  2. Remove the docker image from the repository via web-ui / http-api / nexus-cli, but the free space changes slightly.
  3. Delete the docker image from the repository via web-ui / http-api / nexus-cli and run the cleanup tasks, but it does not work properly
  4. We remove the docker image from the repository via web-ui / http-api / nexus-cli and run cleanup tasks, these steps do delete, but free space is only available for 50% of the size of all docker images.

After some research, I was able to resolve this issue. I haven’t found any documentation on how to supposedly completely erase (hard-delete) the docker images that I deleted via web-ui / http-api / nexus-cli.

Strategy for removing docker images from Nexus OSS Docker Repository

I realized that there was a need for well-planned actions on the part of the Nexus OSS.So, I have prepared steps, step by step, how to solve this problem.

  1. Remove the asset (image tag) via web-ui / http-api / nexus-cli.
  2. Run the task: “Docker — Delete unused manifests and images” via web-ui / http-api / nexus-cli.
  3. Run the task: “Admin — Compact Blob Repository” via web-ui / http-api / nexus-cli.
  4. Add the “rebuildDeletedBlobIndex = true” parameter to the “metadata.properties” file in the root directory of the blob store.
  5. Run the task: Admin — Compact Blob Repository via web-ui / http-api / nexus-cli.

Sequencing plan for an Automation strategy

I also prepared my own sequencing plan for an automation strategy

First of all,remove the asset (image tag) via web-ui / http-api / nexus-cli any time of day whenever you need it.

Daily at midnight Complete tasks:

  1. Run the task: “Docker — Delete unused manifests and images” via web-ui / http-api / nexus-cli.
  2. Run the task: “Admin — Compact Blob Repository” via web-ui / http-api / nexus-cli.

Every Sunday at 11:00pm:

  1. Add the “rebuildDeletedBlobIndex = true” parameter to the “metadata.properties” file in the root of the blob store.
  2. Run the task: “Admin — Compact Blob Repository” via web-ui / http-api / nexus-cli.

By completing these steps — you won’t have such “strange” problems that I wrote above.

How to Implement/Check

To impement/check this issue you can use my script(After docker login to the Nexus OSS) and generate docker images and push them to Nexus Docker Repository.Then,try to delete images and watch to the result (Disk size)

GistGithub

--

--