LXC Containerisation

Note

This page is only required for Developers' desktops

We use LXC containers for all of our development and internal staging.

The LXC containers are created and hosted on the Proxmox based Cluster machines and can then be cloned to local machines as required

It is also possible to create LXC containers directly on the desktop, though this should only be used for disposable testing type tasks as desktop machines are not backed up in any way.

Installation

There is a bash script in the snippets library to handle installing LXC. Just run

1
bash /opt/Projects/snippets-edmondscommerce/Cluster/shellscripts/desktop/lxc/install.bash

Renaming an LXC Container

Renaming a container is not as straight forward as simply renaming it in your lxc folder, if you do just do that you will also break lxc-attach which means you will not be able to get into the container

Note

This was done from the desktop machine not inside the container

The below will cover the different areas you need to change and what you need to do.

  • mv /var/lib/lxc/"Old-Name"/ mv /var/lib/lxc/"New-Name"/

  • vim /var/lib/lxc/"New-Name"/config Inside here you will want to change all the instances of the old container name with the new one. This should be on lines starting with the following:

    • lxc.rootfs =
    • lxc-utsname =
  • vim /var/lib/lxc/"New-Name"/rootfs/etc/hostname When this opens change the line the match the new container name

When you have done the above just simply exit out of container then stop and start it to make sure the changes have take place

  • lxc-stop "container-name"
  • lxc-attach "container-name"