Getting started with LXC containers

We, sometime need more than one GNU/Linux machines to test some network services, firewall rules, port checkings etc. I was using VirtualBox to install another GNU/Linux os. Used it for all the networking needs.

Using VirtualBox is really heavy. It virtualizes entire os and separate base OS and guest OS. With my 8GB ram laptop, I can run hardly 2 virtual box instances. Was looking for a simple, light weight virtual machines. Found Docker. But it seems to learn a lot. I need even simple one, just to roll out 10 or 15 virtual machines, in my laptop itself.

lxc container க்கான பட முடிவு

LXC Containers:

Found LXC containers. This is very very lightweight. I am running 20 containers in my laptop and created a good network to try various activities. It shares most of the basic resources with the base OS itself. Separates only the minimally required components.

The beauty is I can run many versions of Ubuntu in the same machine.

Few commands to use LXC:

sudo apt-get install lxc


Create a container:
syntax : lxc-create -t <template> -n <container name>

Example :
lxc-create -t ubuntu -n ubuntu1604


To get a older version of ubuntu,
sudo lxc-create -t download -n ubuntu1204 — –dist ubuntu –release precise –arch amd64

To list all the containers:

To get information about a container:
sudo lxc-info -n ubuntu1604

To start a container:
lxc-start -n <container name>
sudo lxc-start -n ubuntu1604

To get inside the container:
sudo lxc-attach -n ubuntu1604


There are more interesting commands like lxc-clone, lxc-monitor, lxc-snapshot, etc. Exploring them.

Thanks for LXC developers. It makes my life easy. Found that Docker uses LXC as its base. Will explore docker too.

Image source :

Few links to explore about LXC:


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s