[lxc-users] how do you create an image from scratch?

Fajar A. Nugraha list at fajar.net
Wed Apr 26 15:01:38 UTC 2017


On Wed, Apr 26, 2017 at 9:40 PM, Spike <spike at drba.org> wrote:

> yeah I've seen that link before and used the lxd image publish / export
> approach (it's what I'm doing right now in fact). However that post isn't
> very clear on what it takes to start from scratch. There is a section on
> "Manually building an image", but the critical step (2), says: "Configure
> anything that’s needed for the distribution to work properly in a container
> (if anything is needed)." and that's really what I'm asking here.
>
> Because I have everything set up with a fair amount of "magic" to pxe boot
> and configure bare metal and KVM instances, I'd like to use that process
> and avoid having to write more to create the rootfs.
>
> So maybe a better question would be, given a qcow2 (or raw) image created
> with kvm, what are the necessary steps to convert that so that it can be
> used inside a container?
>


If you have an ubuntu image, you should be able to simply comment-out all
entry in fstab, and use it as container rootfs.

I have an ubuntu zfsroot AMI for EC2 (which already has an empty fstab).
And the steps to convert THAT is 'nothing' (if you can tolerate some delays
in service starting, due to zfs errors inside the containers), or simply
uninstall some packages (zfsutils-linux, anything related to cloud-init,
all kernel versions)



> that said having the same steps starting from debootstrap could be handy.
>
>
rootfs created by lxc templates should also be usable in lxd:
https://github.com/lxc/lxc/tree/master/templates
the files include debootstrap/yum and configure steps.

-- 
Fajar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20170426/b1fdf855/attachment-0001.html>


More information about the lxc-users mailing list