Make make docker-clean
to remove docker build cache
#1790
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
Add
docker-clean
sub-targetsdocker-clean-image
&docker-clean-cache
intoMakefile
to remove not only image but cache.What is the current behavior?
After doing a lot of
make docker-shell
/make docker-build
,make clean-full
/make docker-clean
may remove only docker image with IronOS env but not its build cache objects.What is the new behavior (if this is a feature change)?
make clean-full
/make docker-clean
/./scripts/deploy.sh clean
removes all docker data related to IronOS env container.Other information:
I personally use docker very rarely & sporadically. And I know that the modern tendency is not to care about resources (especially disk space) much. But even for me it was surprising to discover that after about a month of working with IronOS image, docker ate ~30 GB of rootfs. So, since there is a way to clean up docker image, this patch adds cleaning up image's cache as well for the convenience of its users.
Also while I was testing this to make sure that it doesn't delete what it shouldn't, "today I learned" that it seems if you run
docker rmi ...
for image which was created bydocker compose
then it deletes build cache as well, BUT if you rundocker rmi ...
for image which was created bydocker-compose
then it deletes only image itself. Yes, I know that there is an option "--no-cache" but it seems it's not supported bydocker-compose
and suchdocker
subcommands ascompose
/compose run
. So, this patch allows to clean up docker cache in a more easy & straightforward way. And it's possible to clean up cache without touching image like that:So on the next
make docker-shell
you go into pre-downloaded & pre-allocated container but with cache & space cleaned.