LXC

From Omnia
Jump to navigation Jump to search

Create LXC Container

Tested on Ubuntu 14.04

Install LXC container:

# sudo apt-get install lxc qemu-user-static
sudo apt-get install lxc qemu-user-static debootstrap rsync binfmt-support

Create ARM container:

sudo lxc-create -t ubuntu -n my_arm -- --release trusty --arch armhf
#   -r trusty -a armhf

Templates are found here: (-t)

/usr/share/lxc/templates/

Start container: (login: ubuntu/ubuntu)

sudo lxc-start -d -n my_arm

Connect to container:

lxc-console -n my_arm

Login:

user: ubuntu
pass: ubuntu

See arm kernel type:

$ uname -a
Linux my_arm 3.13.0-45-generic #74-Ubuntu SMP Tue Jan 13 19:36:28 UTC 2015 armv7l armv7l armv7l GNU/Linux

Install build environment within container: (optional)

sudo apt-get install build-essential git

Escape console:

ctrl+a q

References:

Rename Container

Shutdown container:

lxc-shutdown -n my_arm

Rename folder:

sudo mv /var/lib/lxc/my_arm /var/lib/lxc/new_arm

Change in config file:

sudo vim /var/lib/lxc/new_arm/config
lxc.utsname = new_arm
lxc.rootfs = /var/lib/lxc/new_arm/rootfs
lxc.mount = /var/lib/lxc/new_arm/fstab

References: