LXC containers on a OpenVZ VPS

containerslxcopenvz

I am trying to run LXC on a VPN that is hosted in OpenVZ, I have tried doing this with multiple image flavours, ubuntu. centos, debian… with no luck.
LXC installs correctly but containers fail to start due to networking, it seems this is to do with the bridging of interfaces!

Has anyone had any issues similar to this? Does anyone know if this is a limitation of OpenVZ?

Starting from a fresh ubuntu 14.04 install:

sudo apt-get update 
sudo apt-get install lxc
sudo lxc-create -n p1 -t ubuntu 
sudo lxc-start -n p1 --logfile log.txt
cat log.txt
    lxc-start 1434379565.265 ERROR    lxc_conf - conf.c:instantiate_veth:2949 - failed to create veth pair (vethP4LPC8 and vethO6MP73): Operation not supported
    lxc-start 1434379565.265 ERROR    lxc_conf - conf.c:lxc_create_network:3261 - failed to create netdev
    lxc-start 1434379565.265 ERROR    lxc_start - start.c:lxc_spawn:826 - failed to create the network
    lxc-start 1434379565.265 ERROR    lxc_start - start.c:__lxc_start:1080 - failed to spawn 'p1'
    lxc-start 1434379565.265 ERROR    lxc_start_ui - lxc_start.c:main:342 - The container failed to start.
    lxc-start 1434379565.265 ERROR    lxc_start_ui - lxc_start.c:main:346 - Additional information can be obtained by setting the --logfile and --logpriority options.

And trying:

sudo brctl addbr lxcbr0
  add bridge failed: Invalid argument

Best Answer

OpenVZ is an operating system virtualization technology, just like LXC and Docker but based in various kernel patches, and many never integrate with the mainstream kernel.

OpenVZ was based in old kernels (2.6.x) that don't have many things needed to manage containers now (cgroups mainly). Unfortunely, you can't run LXC Containers inside a OpenVZ virtual environment.

Related Topic