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

Daniel P. Berrange berrange at redhat.com
Wed Apr 5 09:10:44 UTC 2017

On Tue, Apr 04, 2017 at 05:20:19PM +0000, Spike wrote:
> ok, thank you Daniel, that helps, I'll see if I can adapt it to other OS
> and figure out the docker style stuff, it would be useful to run a few
> things I have in mind.
> Btw, Daniel, have you ever tried to run libvirt inside a container? I was
> trying to do so to test things since I didn't want to get all the stuff
> installed on the host, but I got a whole bunch of errors and virt-manager
> would not connect no matter what.

You can run libvirt inside a container - I've done that the same reasons
as you when i wanted to test stuff without messing up my host. It sounds
like you were trying to connect using a virt-manager outside the container,
talking to libvirtd inside the container.

This gets more complicated - virt-manager connects over a UNIX domain
socket at /var/run/libvirt by default. If you're running libvirtd inside
a container, then the /var/run seen by libvirtd will be in the container
filesystem, while the /var/run seen by virt-manager will be the host
filesystem. You'd need to figure out a way for the /var/run/libvirt/libvirt-sock
in the container to be exposed to virt-manager in the host.

Alternatively you would have to make libvirtd listen on a TCP address and
connect over TCP with suitable auth.

|: 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