Some more info in README. Mention rdoc.

This commit is contained in:
Andre Nathan 2014-01-14 09:48:19 -02:00
parent 9a65ddf036
commit 519b08a497

View file

@ -5,22 +5,16 @@
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
```sh
sudo apt-get install lxc liblxc0 lxc-dev
```
Ruby-LXC is currently under ongoing development following the code in
[lxc's master branch](https://github.com/lxc/lxc/tree/master). Once LXC
officially hits version 1.0.0, we will start providing and maintaing stable
releases.
- Build essential for compiling the bindings
```sh
sudo apt-get install build-essential
```
Assuming a current installation of LXC is available, to install Ruby-LXC
simply run the commands below
- Clone this repository and run the commands below (assuming you have bundler).
```sh
bundle install
bundle exec rake compile
@ -38,11 +32,28 @@ gem "ruby-lxc", github: "lxc/ruby-lxc"
c = LXC::Container.new('foo')
c.create('ubuntu') # create a container named foo with ubuntu template
c.start
# attach to a running container
c.attach do
LXC.run_command('ifconfig eth0')
end
c.stop
c.destroy
```
- Additional state changing operations (freezing, unfreezing and cloning containers)
- Container inspection
```ruby
c.name
c.config_path
c.config_item('lxc.cap.drop')
c.cgroup_item('memory.limit_in_bytes')
c.init_pid
c.interfaces
c.ip_addresses
c.state
```
- Additional state changing operations (freezing, unfreezing and cloning
containers)
```ruby
c.freeze
c.unfreeze
@ -52,11 +63,18 @@ c.shutdown
- Clone a container
```ruby
c.clone('bar') # clone foo into bar. parent container has to bee in freeze or stopped state.
# clone foo into bar. Parent container has to be frozen or stopped.
clone = c.clone('bar')
```
- Wait for a state change
```ruby
c.wait('STOPPED', 10) # wait till container goes to STOPPED state, else timeout after 10 seconds
# wait until container goes to STOPPED state, else timeout after 10 seconds
c.wait(:stopped, 10)
```
Check the provided rdoc documentation for a full list of methods. You can
generate it running
```sh
rake rdoc
```