Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make make docker-clean to remove docker build cache #1790

Merged
merged 3 commits into from
Aug 9, 2023
Merged

Conversation

ia
Copy link
Collaborator

@ia ia commented Aug 8, 2023

  • Please check if the PR fulfills these requirements
  • The changes have been tested locally
  • There are no breaking changes
  • What kind of change does this PR introduce?
    Add docker-clean sub-targets docker-clean-image & docker-clean-cache into Makefile 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 by docker compose then it deletes build cache as well, BUT if you run docker rmi ... for image which was created by docker-compose then it deletes only image itself. Yes, I know that there is an option "--no-cache" but it seems it's not supported by docker-compose and such docker subcommands as compose / 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:

make docker-shell
...
exit
make docker-clean-cache

So on the next make docker-shell you go into pre-downloaded & pre-allocated container but with cache & space cleaned.

ia added 2 commits August 7, 2023 02:04
…ache (eats lot of space sometimes) & update help output / add clean-up of docker cache to deploy.sh as well
Copy link
Owner

@Ralim Ralim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good.
This is becoming a very large Makefile though and this doesn't really need to be part of this repository.

This is starting to feel a lot more like a legacy program from then 90's than I would prefer. Especially as moving to cmake and dropping make is still on the agenda for when I get time.

@Ralim Ralim enabled auto-merge (squash) August 9, 2023 05:35
@Ralim Ralim merged commit 130e73c into Ralim:dev Aug 9, 2023
@ia ia deleted the docker-clean branch August 13, 2023 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants