Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
99 lines (70 sloc) 2.82 KB


Set of tools to work with LXC containers and host system.

Extracted from experimental scripts and currently under development.


  • Ubuntu 11.04 / 11.10 64-bit system
  • Superuser privileges (required in some scripts)
  • Ruby 1.8.7 / 1.9.x


To install all utilities, run:

git clone
cd lxc-tools
rake install

All files will be installed under /usr/local/bin on your system.


  • lxc-setup-network - Setup and configure bridge interface for containers
  • lxc-setup-container - Create and configure a new LXC container
  • lxc-setup-rootfs - Create and configure rootfs for containers


This utility will create a new network interface br0 for LXC containers. By default, this bridge interface will be configured on 192.168.1.x address space.


Usage: lxc-setup-network [options]
    -h, --help                       Display this information.
        --host INTERFACE             Host interface name
        --bridge INTERFACE           Bridge interface name
        --bridge-ip IP               Bridge interface IP address

Network configuration commands will be executed as sudo so make sure user has a proper privileges.


This utility will debootstrap a clean filesystem for LXC containers. Was only tested on 64bit ubuntu 11.04/11.10 systems. Usage:

Usage: lxc-setup-rootfs [options]
    -h, --help                       Display this information.
        --variant NAME               Bootstrap variant. Default: minbase
        --components LIST            System components
        --packages LIST              List of packages to install
        --release NAME               Release name
        --arch ARCH                  Release architechture
        --path PATH                  Extract path


This utility will create and configure a new LXC container. Basic usage:

Usage: lxc-setup-container [options]
    -h, --help                       Display this information.
    -n, --name NAME                  Container name
    -p, --path PATH                  Mount path
        --rootfs PATH                Path to clean rootfs
        --memory MEGABYTES           Memory limit in megabytes
        --net-ip IP                  Assign IP address
        --net-gateway IP             Container gateway IP
        --net-mask MASK              Container netmask

Before using container setup tool you must have a source rootfs, which will be used as a base for a new container. For more information check lxc-setup-rootfs utility.

It also requires a few ruby libraries before you can use it. Run:

gem instal terminal_helpers mustache

Execute as:

lxc-setup-container --name app1 --rootfs /path --path /lxc/app1


See LICENSE file for details