LXC/LXD install operating system from custom dvd image

lxc

I have a dvd image which is a custom installer for OpenSuSE.

My PC is running Ubuntu 16.04.

I want to install a new virtual operating system with this image.

Since I would like to have a lightweight virtualization I think lxc/lxd is the right choice.

All docs I read don't use a custom image but a vanilla version like this:

lxc-create -t download -n u1

Source of above line: https://help.ubuntu.com/lts/serverguide/lxc.html

But this does not help me, since I have a custom dvd image 🙁

Just to be more precise: I want to install a new operating system. Just executing the dvd image is not enough.

Update

I have experience with kvm. With kvm this is very easy. I want to use lxc since it is more lightweight. I know that the OpenSuSE operating system running in lxc will use the linux kernel from my Ubuntu PC. But that's ok, since I won't do kernel related testing.

Best Answer

lxc-create -t download actually uses OS templates which are built with LXC in mind.

You can use lxc-create, but you probably need to build a custom template script (see e.g. https://wiki.gentoo.org/wiki/LXC#Template_scripts for some pointers).

The relationship between an OS DVD and the kind of OS templates LXC expects is pretty much the same as the relationship between the OS DVD and a docker container. Possibly because docker builds on LXC.

You can use the OS DVD to provision a suitable template for LXC (or docker, or whatever else you want to use), but AFAIK you cannot have the DVD install into a container directly.

If you want to go from a DVD to a working system, it sounds like what you want/need is a virtual machine, rather than a container like LXC.

But you can most likely build an LXC template/rootfs from your DVD if you really want to - I would check the template scripts that ship with LXC as a way to get started.

You could also, depending on what makes your DVD custom, just use a suitable LXC template or docker image (docker may be easier for you to use here, as it will allow you to avoid creating a base image from scratch) for openSUSE, and then build in the extras your DVD provides.