$30 off During Our Annual Pro Sale. View Details »

A short introduction to LXC

Ranjib Dey
February 21, 2014

A short introduction to LXC

A short introduction to LXC, an user space implementation of container on mainline linux, and the ecosystem around it

Ranjib Dey

February 21, 2014
Tweet

More Decks by Ranjib Dey

Other Decks in Technology

Transcript

  1. A short introduction to LXC Ranjib Dey System Administrator, Bay

    Area Large-Scale Production Engineering – 02/20/2014
  2. Containers - Light weight virtualization - software based virtualization -

    userspace entity in mainline linux kernel (lxc) - built using kernel's containment facility
  3. Parts of a LXC container - rootfs - config -

    fstab - liblxc (dependency)
  4. Customizing containers - template specific customizations - general configurations -

    cgroup related configurations - hooks - snapshots, overlayfs backed workflows - lxc-download pulls stock rootfs (CI backed)
  5. LXC packaging - liblxc is all you need to run

    - lxc-template offers linux distros - lxc all the binaries, stock configs
  6. Extending lxc - use template & download to build them

    - use config api to add run time configuration - build additional tools using any of the bindings - bindings: python, lua, ruby, Go.
  7. Extending lxc - simple example: #!/usr/bin/python3 import lxc container =

    lxc.Container("my_container") container.create("ubuntu", {"release": "precise"}) container.start() print(container.get_ips(timeout=10)) container.shutdown(timeout=10) container.destroy()
  8. Extending lxc - more complex example: #!/usr/bin/ruby require 'chef/lxc' lxc

    "web" do template "ubuntu" recipe do package "apache2" service "apache2" do action [:start, :enable] end end action [:create, :start] end
  9. Whats next? - lxc 1.0 released today - better user

    namespace support - tools for extensible storage - union file system(aufs, overlayfs) - s3, gfs, swift/glance etc - CRIU & pr.haul - Docker, Maestro, Deis, Hroot etc