-
Notifications
You must be signed in to change notification settings - Fork 223
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
proposal: Dnf cache between containers #526
base: main
Are you sure you want to change the base?
Conversation
…ed by the containers
… install them. By default dnf remove the installed packages, but for the shared dnf cache to be useful, the packages must remain.
Build failed.
|
Hi @juanje! I also read the article and I've been thinking of adding such feature to Toolbox. Thank you for working on this! Since v0.1.0 is not out yet and we'd like to make as stable as possible without adding any new features, I add this to the 0.2.0 milestone.
I'm not sure about the Another thing, Toolbox currently does not work if it is run with |
Thanks for reviewing the PR 😄
That makes a lot of sense 😄
I was thinking the same, but I wasn't sure about how distro agnostic Toolbox really was (or wanted to be).
Well, IMO the big advantage of having this feature is to download the packages just once and reutilize them from each container from the same distro-release. This way, you save a lot of time and bandwidth. But without this option, every time you install something, the package gets removed, so the cache doesn't do much. I tried first without the option and each container downloaded the same packages every time. Then, I added the option and it just downloaded the first time, the rest each container just used the downloaded packages.
Sure. I don't know well all the code and that part is the least I know hehe Although I know this is going to be on hold until the milestone 0.2.0, I'll look into it to understand better the code and where it could fit at the
I probably miss out more user cases. This was a naive attempt to have a working PoC, but I'm aware that it needs some thinking. |
I just realized there was a similar PR in the past. Putting it here for reference. #239 |
Hi!
Disclaimer: This is just a proposal, but with initial implementation as a PoC. I tried to mimic the code and be the least intrusive as possible, but I'm sure that it can be improved.
The idea
Toolbox is a very useful tool for developers and the fact that create quickly dev environments that can be destroyed is awesome. But when you work with different containers or destroy-and-create containers frequently, you might want your packages cached, so the new container's provision doesn't take long.
Also, some people work in environments with limited Internet connection.
That's why I think it'd be good idea to create external (to the containers) cache for the packages, so it can be shared between the containers and you don't need to download again and again the same packages.
Inspiration
I've used a lot Vagrant with vagrant-cachier and saved me plenty of time and bandwidth.
Also, I read this article recently and it makes think about dong something similar for Toolbox:
Speed up container builds with overlay mounts
Some considerations
The external cache is located at:
~/.cache/toolbox/{release}
The location
~/.cache/{APP_NAME}
seems to be the standard for modern application's user's caches. I added the{release}
subdirectory to avoid share dnf's caches between containers from different releases and mess it up.I noticed that
dnf
remove the packages after the installation, so I add the optionkeepcache=True
to the config file/etc/dnf/dnf.conf
at the Dockerfiles for the different Fedora images. Otherwise, the shared cache would be a bit useless.