Some more info in README. Mention rdoc.
This commit is contained in:
parent
9a65ddf036
commit
519b08a497
48
README.md
48
README.md
|
@ -5,22 +5,16 @@
|
||||||
Ruby-LXC is a Ruby binding for liblxc. It allows the creation and management
|
Ruby-LXC is a Ruby binding for liblxc. It allows the creation and management
|
||||||
of Linux Containers from Ruby scripts.
|
of Linux Containers from Ruby scripts.
|
||||||
|
|
||||||
|
|
||||||
## Build and installation
|
## Build and installation
|
||||||
|
|
||||||
Currently the binding is developed and tested against liblxc 1.0.0 build. To build ruby-lxc you need
|
Ruby-LXC is currently under ongoing development following the code in
|
||||||
- ubuntu 14.04
|
[lxc's master branch](https://github.com/lxc/lxc/tree/master). Once LXC
|
||||||
- lxc ipackage
|
officially hits version 1.0.0, we will start providing and maintaing stable
|
||||||
```sh
|
releases.
|
||||||
sudo apt-get install lxc liblxc0 lxc-dev
|
|
||||||
```
|
|
||||||
|
|
||||||
- Build essential for compiling the bindings
|
Assuming a current installation of LXC is available, to install Ruby-LXC
|
||||||
```sh
|
simply run the commands below
|
||||||
sudo apt-get install build-essential
|
|
||||||
```
|
|
||||||
|
|
||||||
- Clone this repository and run the commands below (assuming you have bundler).
|
|
||||||
```sh
|
```sh
|
||||||
bundle install
|
bundle install
|
||||||
bundle exec rake compile
|
bundle exec rake compile
|
||||||
|
@ -38,11 +32,28 @@ gem "ruby-lxc", github: "lxc/ruby-lxc"
|
||||||
c = LXC::Container.new('foo')
|
c = LXC::Container.new('foo')
|
||||||
c.create('ubuntu') # create a container named foo with ubuntu template
|
c.create('ubuntu') # create a container named foo with ubuntu template
|
||||||
c.start
|
c.start
|
||||||
|
# attach to a running container
|
||||||
|
c.attach do
|
||||||
|
LXC.run_command('ifconfig eth0')
|
||||||
|
end
|
||||||
c.stop
|
c.stop
|
||||||
c.destroy
|
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
|
```ruby
|
||||||
c.freeze
|
c.freeze
|
||||||
c.unfreeze
|
c.unfreeze
|
||||||
|
@ -52,11 +63,18 @@ c.shutdown
|
||||||
|
|
||||||
- Clone a container
|
- Clone a container
|
||||||
```ruby
|
```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
|
- Wait for a state change
|
||||||
```ruby
|
```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
|
||||||
|
```
|
||||||
|
|
Loading…
Reference in a new issue