But recently I learned that those templates are deprecated. And distrobuilder is to be used.
The templates that’s left are:
busybox - Not an option for me. I generally need CentOS, Debian, Ubuntu, whatever.
download - I’d like to have OS as close to original as possible. Not sure if that’s the case with pre-built images. What do you say? And I generally use privileged containers if that matters.
local - This one consumes images, one can create with distrobuilder as I now see. The ones you create with e.g. distrobuilder build-lxc /usr/share/distrobuilder/centos (creates meta.tar.xz and rootfs.tar.xz).
oci - This allows to make use of Docker containers. But I generally need just some plain stock Ubuntu, or CentOS. So doesn’t seem to be useful to me at least for now, does it?
And there’s distrobuilder. build-dir just creates rootfs. build-lxc creates archived rootfs (rootfs.tar.xz) and supposedly config (meta.tar.xz). Which I can use with lxc-create -t local. pack-lxc probably creates rootfs.tar.xz and meta.tar.xz from rootfs dir.
Okay, I now see that I can probably create LXC container with
But how do I configure it? I see 2 * 5 configs in meta.tar.xz. What are the other ways to create LXC container? What needs to be done to be able to lxc-start LXC container? Let’s leave deprecated templates out of the discussion. I’d like to learn the new way. Thanks in advance.
That lxc-create should have given you a working container, the same way that lxc-create -t centos -n blah would have in the past and similar to what lxc-create -t download -n blah -- -d centos -r 7 -a amd64 would have in 2.0 and still now in 3.0.
distrobuilder will create an image with minor corrections (compared to official distribution) specified in /usr/share/distrobuilder/centos. lxc-create would copy it to /var/lib/lxc and create a config. Correct me whenever I’m wrong, please.
Note that the images found on this image server are unofficial images. Whenever possible, you should try to use official images from your Linux distribution of choice. Images from this server are provided as a convenience with no guarantee whatsoever.
So, in the first case, changes made to an image downloaded from distribution’s server can be found in /usr/share/distrobuilder/centos. What about lxc-create -t download? Somewhere in this repo? Can you point at probably entrypoints? Relevant files?
Also, is build-lxc basically build-dir + pack-lxc?
build-lxc is indeed equivalent of build-dir + pack-lxc, most users won’t need to use the build-dir action. That action was added mostly for our own needs where we build and publish images for both LXC and LXD.
Config customization for LXC should be done in /var/lib/lxc/CONTAINER-NAME/config as was the case before.
If you want a change to affect all newly created containers you may put it in /etc/lxc/default.conf.
If there’s something you wish all your containers to have (existing and future), you can put it in a file in /usr/share/lxc/config/common.conf.d/
Sorry, for probably being persistent. But from what I can see CentOS minimal image is 906M large: http://centos.uib.no/7/isos/x86_64/, but with download template I get:
The CentOS link you posted is from an ISO, which contains all the necessary packages and files to install a distribution. The container image only contains a small set of packages that allow you to run the distribution, that is why there is that big difference on the size.
I hate to hijack this thread, and if I’m off-base, please feel free to delete my post and tell me to start a new thread.
Regarding this discussion, I’m trying to figure out if there is a means to create a CentOS 7 container image for the armhf architecture? I’m so new to container technologies, so please forgive my lack of knowledge. Running LXD on Ubuntu 18.04 on a rather low power Raspberry Pi 3. Actually runs rather well, but have a need for a CentOS container. Was able to deploy via Docker, but no LXC\LXD options seem to exist for CentOS on armhf currently. If it’s possibly for someone to spin their own container image for CentOS armhf, might there be some guides or howto’s on the subject? Thanks in advance…
If you can first create a CentOS container using distrowatch, then it is very easy to add the container image into LXD and launch containers from that container image.
I am trying to create a custom image for LXC container. I have used this command
$ lxc-create -t local – --fstree rootfs.tar.xz --metadata meta.tar.xz`
But instead of creating by itself, may be it is asking for some input which I am not sure what to give input. Can you please tell me how can I create a container for a custom image. If it is possible, please explain with a example container creation like this https://blog.simos.info/using-distrobuilder-to-create-container-images-for-lxc-and-lxd/ post.
Thanks in advance.
this problem is fixed now. actually the rootfs.tar.xz and meta.tar.xz files do not exist on the directory before. when the image file is complied, these two rootfs.tar.xz and meta.tar.xz creates.