ruby bindings for liblxc
Find a file
Andre Nathan 67dd08eeeb Merge pull request #6 from ranjib/fix_readme
Change readme to point new lxc repo
2014-01-10 04:05:59 -08:00
ext/lxc Support large bdevs on 32-bit 2014-01-09 08:33:25 -02:00
lib Standardizing project structure 2013-12-06 14:59:02 -02:00
test Add a few specs against LXC singleton methods 2013-12-26 09:03:56 -02:00
.gitignore add bundler support 2013-12-16 12:30:12 -08:00
.travis.yml add 1.8.7 to travis build 2013-12-27 12:18:42 -08:00
Gemfile add bundler support 2013-12-16 12:30:12 -08:00
LICENSE Standardizing project structure 2013-12-06 14:59:02 -02:00
Rakefile Add (still incomplete) RDoc. 2013-12-27 15:44:24 -02:00
README.md change readme to point new lxc repo 2014-01-09 14:37:17 -08:00
ruby-lxc.gemspec Standardizing project structure 2013-12-06 14:59:02 -02:00

Ruby-LXC

Introduction

Ruby-LXC is a Ruby binding for liblxc. It allows the creation and management of Linux Containers from Ruby scripts.

Build and installation

Currently the binding is developed and tested against liblxc 1.0.0 build. To build ruby-lxc you need

  • ubuntu 14.04
  • lxc ipackage
sudo apt-get install lxc liblxc0 lxc-dev
  • Build essential for compiling the bindings
sudo apt-get install build-essential
  • Clone this repository and run the commands below (assuming you have bundler).
bundle install
bundle exec rake compile
gem install pkg/ruby-lxc-0.1.0.gem

or just add this to your Gemfile

gem "ruby-lxc", github: "lxc/ruby-lxc"

Usage

  • Container lifecycle management (create, start, stop and destroy containers)
c = LXC::Container.new('foo')
c.create('ubuntu') # create a container named foo with ubuntu template
c.start
c.stop
c.destroy
  • Additional state changing operations (freezing, unfreezing and cloning containers)
c.freeze
c.unfreeze
c.reboot
c.shutdown
  • Clone a container
c.clone('bar') # clone foo into bar. parent container has to bee in freeze or stopped state.
  • Wait for a state change
c.wait('STOPPED', 10) # wait till container goes to STOPPED state, else timeout after 10 seconds