LXC – Fast virtualization with Linux containers – X86 and ARM

Stéphane Graber explains how to get started with linux containers on Ubuntu 12.04 here:-

Creating a basic container and starting it on Ubuntu 12.04 LTS is now down to:
  sudo apt-get install lxc  sudo lxc-create -t ubuntu -n my-container  sudo lxc-start -n my-container
I needed this, because the container name was wrong.
sudo cp -rf my-container/ my-cloud-container/
This will default to using the same version and architecture as your machine, additional option are obviously available (–help will list them). Login/Password are ubuntu/ubuntu.
Container shuts down when the running system is shut down with the “halt” command.
Shut down a crashed container with:-
sudo lxc-stop -n my-container-name
It’s now possible to use qemu-user-static with LXC to run containers of non-native architectures, ARM for example:
sudo apt-get install lxc qemu-user-static

sudo lxc-create -t ubuntu -n p3 -- -a armhf

sudo lxc-start -n p3 -d

sudo lxc-attach -n p3


sudo lxc-stop -n p3

Use the code below to test your ARM gcc compiler.
Save the code as test.c, compile with gcc test.c, and run with ./a.out.
It will put hello on the screen.


This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s