Custom Lxc Template
“(Please note that this question is about LXC 1.x, whereas this one is about LXC 2.x/LXD)\r\n\r\nI scoured the web for an answer to this one, but couldn't come up with any reasonably non-hacky answer.\r\n\r\nWhat I am looking for is an approach to fashion an existing template a way I'd like to. In particular what I'm after is to customize the upstream Ubuntu cloud image by making various changes in its root FS and adding/changing configuration.\r\n\r\nSo my current approach is to lxc launch ubuntu:lts CONTAINER
and then use lxc exec CONTAINER -- ...
to run a script I authored (after pushing it into the container) to perform my customizations.\r\n\r\nWhat I get using this approach is a reasonably customized container. Alas, there's a catch. The container at this point has been primed by cloud-init
and it's a container instance, not an image/template.\r\n\r\nSo this is where I'm at a loss now. What I would need is to turn my container back into an image (should be doable by using lxc publish
) and either undo the changes done to it by cloud-init
or at least "cock" cloud-init
again so it triggers the next time the image is used as source for lxc init
or lxc launch
. Alternatively, maybe there's a way to completely disable cloud-init
when I lxc launch
from the upstream image?\r\n\r\nIs there an authoritative way? Even though I looked through all kinds of documentation, including the Markdown documentation in the LXD repository as well as the blog series by Stéphane Graber (LXD project lead), [especially \[5/12\]][1], I was unable to find a suitable approach. Perhaps I just missed it (that's to say, I'll be happy to read through more documentation if you know some that describes what I need).\r\n\r\nLXC version used is 2.20 (i.e. I'm using the LXD frontend).\r\n\r\n\r\n [1]: https://stgraber.org/2016/03/30/lxd-2-0-image-management-512/"
<a href=““https://unix.stackexchange.com/questions/407315/creating-a-custom-template-based-on-some-existing-lxc-template-after-running-th"">— “0xC0000022L”