Install openITCOCKPIT in LXC • December 6, 2019
Tags: Tutorial | openITCOCKPIT | LXC | Virtualization

In the course of migrating some services from very old openVZ machines I decided to use a powerful KVM Host with Proxmox to manage some applications in LXC and docker.

With my openITCOCKPIT installation, the migration to an LXC did not work using LXC default settings!

openITCOCKPIT needs to create own docker containers, but using docker in LXC wasn´t as easy as I thought.

After some annoying hours I got it working and in the end it wasn't that hard to set up :)

Now it´s my productive setup.

First of all, I do not recommend to use openITCOCKPIT in a LXC for productive purposes!
(... as I do and I should not! I know!)

openITCOCKPIT LXC container overview

If you either want to try an installation, make sure the following points are suffused and follow the steps below.

  • You should have root access to the LXC host (tested with Proxmox LXC)

  • You can create a container on local storage (as raw file)

  • You have internet access ;)

1. Install docker-ce on the host system (Link to the docker documentation)

2. Create a privileged container

This can not be changed after container creation.

Privileged LXC container

I recommend choosing a current Ubuntu or Debian template. (Unfortunately openITCOCKPIT does not currently support Debian 10)

3. Choose local storage with storage type 'dir' to create a raw image! (zfs or lvm did´t work in my case!)

Choose a local storage

4. Give the container 2 CPU cores (x86-64), 2 GB RAM, a little swap if you want and 20 GB storage (as in my current setup)

5. After creation, edit the configuration file of your new container

Open /etc/pve/lxc/$ID.conf on your host machine. Replace $ID with your container id (e.g. 204).

If you don´t use Proxmox, your configuration file is in a different path.

Maybe you can edit it using the lxc command and your container name ($NAME)

lxc config edit $NAME

Add this line:

lxc.apparmor.profile: unconfined

6. Start the new container and run the default openITCOCKPIT installation

Why did I do it that way?

I wanted to save up money (and ressources)!

You could also pass the host's docker socket into the container so that the containers from openITCOCKPIT are set up directly on the host machine, but running docker in LXC makes it easier to update, save or remove the openITCOCKPIT instance.