Is it Possible to add custom LXC repos for templates?

jbwill

New Member
Aug 31, 2023
2
0
1
While I believe this is possible to add a custom repo for LXC containers through the Linux subsystem, I do not wish to break anything so I would like to find out if there is a correct/blessed way to do this? It would save me a ton of time deploying repetitive containers.
 
Hi!

Yes, this is possible, you have basically three possible ways to do something like that:
  1. Set up one container like you want it to be for your basis system, and just clone that to if you need a new CT. This is simple and allows you to add/change stuff or make further improvements to the base system in the future.
  2. Basically the same, but use the fact that a CT template is basically just a (compressed) tar archive, so do the same as before, set up your system as you like and then create a backup. You can now either restore from that, or move the file to the CT template directory of a storage (e.g., the template/cache directory inside a storage mount point)
  3. Use tools that can build CT Templates (i.e., rootfs tarballs) from scratch, like our dab (Debian Appliance Builder) for Debian or Ubuntu based templates. This is certainly more involved, but also quite flexible and can be nicely scripted, for details see https://pve.proxmox.com/wiki/Debian_Appliance_Builder
Depending on your experience and how comfortable you are with using a bit lower-level Linux CLI tools, DAB might be a good option. But if unsure, I'd go for suggestions 1 or 2 from above, those have definitively a lower learning curve, and you can do most (if not all) things that DAB allows.
 
Thank you for this information, I did not know DAB was a thing and I dont recall seeing anything in the manual, which is really cool. It looks like debootstrap or something similar at a quick glance.

More especially what I would like to accomplish is using our existing image repository of containers and images which we have built as templates for rapid deployment, and which we could plugin and have populated like the turnkey and OS Images. Currently, we can fetch by exact URL. Still, it requires having the exact URL, and with each of our stacks using different images with different purposes, different development cycles, etc... that becomes more burdensome and complicated for internal documentation upkeep and it would allow for better automations and scripting. There are a ton of practical applications for which this could be applied. Labs, testing, subscriptions (not unlike your own for enterprise and community) among others. I hope this makes sense because it does in my mind anyways, and I am not aware of much discussion on the topic (at least not from search). Thanks again for the quick response and great information, look forward to the continued discussion.
 
It looks like debootstrap or something similar at a quick glance.
Yes, it basically is an elaborated debootstrap wrapper that currently uses LXC for the sandbox environment where the template is created in.
More especially what I would like to accomplish is using our existing image repository of containers
Hmm, support for custom (self-managed or third-party) repos sounds interesting, it basically would need two config values, the URL (or path) of the repo and a public (GPG) key to verify its integrity. I think we could accept something like this in Proxmox VE, at least some CLI only integration.

Feel free to open an enhancement request over at https://bugzilla.proxmox.com/ but, to manage expectations, for our devs it'd be probably very low priority, so probably not happen in the short/midterm, but if you got some dev experience maybe implementing it yourself would be an option: https://pve.proxmox.com/wiki/Developer_Documentation

As we, as you noticed, already support two repos, ours and the one from our solution partner TurnKey, most of the code is already prepared for handling multiple repos, so it might not be that complex to add (but just a guesstimation, didn't check that part of the code since a while).
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!