LXC::Extra
Helper methods for ruby lxc binding
Installation
Add this line to your application's Gemfile:
gem 'lxc-extra', github: 'ranjib/lxc-extra'
And then execute:
$ bundle
Usage
Core LXC ruby bindings exposes liblxc api. LXC::Extra provides few additional methods. For example, the attach
method
from core lxc allows executing arbitrary ruby code inside a container. Since the attach
method does so via spawning a child process
inside the container, getting any data back from the attach block requires IPC. LXC::Extra provides execute
method that wraps the attach
method
and does the IPC magic for you, using IO.pipe
.
require 'lxc/extra'
ct = LXC::Container.new('test')
data = ct.execute do
# run some code
end
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request