I have a lot of experience using OpenVZ, but I want to give LXC a try on a server where perfect isolation is not a concern. The main reason for the switch is preferring Ubuntu Server LTS as the base OS, but the OpenVZ project currently only supports the RHEL kernel and the latest kernel patch is for 2.6.32.
This new server is running Ubuntu 12.04 LTS. I found it's very simple to create a container using the provided container templates, i.e., lxc-create -t ubuntu -n testvps -B lvm --vgname vps --fssize 20G --fstype ext4
. However, I have yet to find any substantial information that explains how to take a precreated OpenVZ template and use it as the base for a LXC container. The articles I've seen basically recommend OpenVZ templates as a good option for LXC containers. But how? This article comes close, but it uses paths Ubuntu 12.04 does not and extracts directly to the filesystem instead of a LVM logical volume. Being so new to LXC, I'm sure I must be missing something. I need to know where I should put the OpenVZ template tarball (or extract it) so the lxc-create -t` command can initialize from it.
I need to create a LXC container, on a LVM volume, under Ubuntu 12.04 from the OpenVZ precreated CentOS 6 template. Any help pointing me in the right direction would be greatly appreciated. Thank you!
I do this all the time using LXC and the OpenVZ CentOS templates.
The two guides I followed initially are here and here.
I usually place my containers under
/srv/
or/srv/lxc/
. I don't bother with LVM, but if you want to, just mount your new LVM volume under/srv/lxc/container_name
per-container. That makes sense, right?In this example, I have a ZFS-on-Linux mount at the place where I want the container to reside under
/srv
:As for the LXC installation, I take the prebuilt OpenVZ image and put it in the destination container directory, then unpack it -
tar -ztvf centos-6-x86_64-devel.tar.gz
. Nothing needs to be modified on the template to make this work.Maybe I'm off, but I choose to use the containers directly on a filesystem. Are you doing something different?
I can provide excerpts of the lxc config files, but you don't seem to have an issue with that.