Improve docker cleanup script to also include old builds and images
What does this MR do?
The current script is not sufficient as it also leaves old images, builds that also contribute to the unused space.
Why was this MR needed?
I propose to improve the script to include clearing the old build and images as part of the clean up process.
What's the best way to test this MR?
- Register a docker runner and choose
dockeras your runner executor. Add the tag in your pipeline job
- Once you run the pipeline it will create the docker images and volumes
- Use the following command to check the volumes
#Check images docker images -q --filter "dangling=true" #Check volumes docker volume ls -qf dangling=true --filter label=com.gitlab.gitlab-runner.type=cache
- Execute the clear docker script to delete the dangling images and volumes.
- Repeat step 3 to confirm that the images and volumes have been deleted
What are the relevant issue numbers?
This has been inspired by a couple of tickets e.g. #155060 (internal) that have had the same issue but the current script was not sufficient
Documentation changes: !2586 (merged)
closes #25458 (closed)