Skip to content
This repository has been archived by the owner on Mar 31, 2022. It is now read-only.

Add new "rmi" mojo to remove images #134

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

cnaj
Copy link

@cnaj cnaj commented Feb 2, 2018

I'm happily using this great plugin in a CI environment, however I have to regularly clean the build host from stale images. This pull request adds a rmi goal that behaves like docker rmi and binds to the pre-clean phase by default.

Additionally, two integration tests make sure the goal can be called, however, no automatic verification if the image was removed is performed. Let me know if I should try to add such a test, which would probably involve calling docker-client classes from verify.groovy.

@mattnworb
Copy link
Member

Thanks for the contribution! I have not had a chance to take a look at the code yet, but can I ask why not simply cron or regular run something like docker system prune on the build host to tackle the same goal?

@cnaj
Copy link
Author

cnaj commented Feb 2, 2018

We have some projects that depend on other projects’ images as base image. For this, we need an image name in the Dockerfile, so we tag the base image. Once all the images are built and deployed, we could untag and delete the images.

Since we do this for every branch in our CI system, our build host fills up pretty fast. For now, a cron job can clean up the unreferenced images, identify deleted branches and remove those images too, but I feel it’s more straight forward to just delete the images right after the build. If I’ve missed a better approach, I’d be happy to hear it :-)

@danielvinitski
Copy link

when it will be merged to master?

@pytomtoto
Copy link

when it will be merged to master?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants