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

caching: cache rm-img shouldn't delete images which might be needed #228

Open
ethanjli opened this issue Jun 13, 2024 · 0 comments
Open
Assignees
Labels
bug Something isn't working
Milestone

Comments

@ethanjli
Copy link
Member

ethanjli commented Jun 13, 2024

Currently, if there are any container images which are not needed by the currently-active containers, the cache rm-img command will delete those images. This is because we're just using the Docker API client's ImagesPrune method. It would be more correct for us to keep any images which are needed by the current and next staged pallet bundles (and maybe also any images needed by the current pallet?), so that those container images are available during boot when we don't have internet access to download any missing container images.

Since image pruning is somewhat complex behind-the-scenes, here are some ideas for how we might implement this fix:

  • Instead of pruning all images using the Docker API Client, we could just use the Docker API Client to manually delete a list of tagged images, and then we could prune dangling images afterwards.
  • We could just prune all images not attached to containers, but also keep a cache of all container images in a separate storage (caching: Enable caching & loading of container images in Forklift's cache #245 ) which we can prune ourselves, so that we can load them back into the Docker daemon if they're required but missing on the next boot. This may be somewhat wasteful of SD card space, though, since we'd have two copies of each container image.

Also, the rmImgAction function should be moved from the cmd/forklift/cache/cache.go file to the cmd/forklift/cache/images.go file

@ethanjli ethanjli added the bug Something isn't working label Jun 13, 2024
@ethanjli ethanjli self-assigned this Jun 14, 2024
@ethanjli ethanjli changed the title cache rm-img shouldn't delete images which might be needed caching: cache rm-img shouldn't delete images which might be needed Jun 14, 2024
@ethanjli ethanjli added this to the Backlog milestone Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant