Linux containers

This section addresses the installation of Linux and creating and managing containers.

Installation

LXC 1.0 was tested with TPVM. The lxc package can be installed as root by means of the apt-get install lxc command.

Your system will then have all the LXC commands, all LXC templates, and also the python3 binding should you want to script LXC.

Creating containers

You can create privileged or unprivileged containers. (Only privileged containers were tested for this release.)

Privileged containers are containers created by root and running as root. They can be created as follows: sudo lxc-create -t download -n my-container

This creates a new privileged container "my-container" on TPVM, using an image based on the download template. The download template contains a list of distributions, versions, and architectures to choose from. Good example templates would be "ubuntu" and "trusty".

Running and monitoring containers

Once the container is created, start it by using the lxc-start -n my-container -d command.

You can then confirm its status by using either of the following commands:
  • lxc-info -n my-container
  • lxc-ls -f

You can access the my-container console by using thelxc-console -n my-container command.

You get a shell inside the container by using the lxc-attach -n my-container command.

Once done, you can stop the container by using the lxc-stop command, and remove it by using the lxc-destroy command:
  • lxc-stop -n my-container
  • lxc-destroy -n my-container

To confirm connectivity, attach to one of the containers and check network access by pinging a server accessible from the host:

  • lxc-attach -n lxc1
  • ping external-server