[libvirt-users] creating a lxc image to be used with libvirt-lxc

Daniel P. Berrange berrange at redhat.com
Tue Apr 4 09:59:23 UTC 2017


On Mon, Apr 03, 2017 at 05:52:33PM +0000, Spike wrote:
> Dear all,
> 
> I'm moving my first baby steps with libvirt-lxc trying to convert over from
> an LXD installation and one of the hurdles is putting together an image.
> 
> All the examples I found about libvirt-lxc refer to running /bin/sh in a
> container, almost as if it was docker, as opposed to run a "full system"
> like I've been doing with lxd. Also virt-install, often referred in libvirt
> docs, seems to be specific/only for kvm.
> 
> Can anybody point me to any documentation to achieve the same as you'd do
> with lxd? would it even just work to use those images (
> https://cloud-images.ubuntu.com/) with libvirt? Last but not least, is
> there any way to "publish" a modified image so that I could make changes to
> any of the above and then reuse the modified one as a base for other
> containers?

Libvirt LXC doesn't really care what you run inside the containedr - it is
possible to use it to run a single application (docker style), or to run a
full operating system. You essentially just need to populate a chroot with
the operating system install you want to run.

I've previously tested with a Fedora chroot:

  https://www.berrange.com/posts/2013/08/12/running-a-full-fedora-os-inside-a-libvirt-lxc-guest/

If you want to have layered modifications, then the best bet is probably
to make use of overlayfs with your chroots. ie populate a base chroot
and treat it as read-only thereafter. Then create a new directory mounted
with overlayfs to add a writable layer on top.


Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://entangle-photo.org       -o-    http://search.cpan.org/~danberr/ :|




More information about the libvirt-users mailing list