cookbook 'container', '= 0.2.0', :supermarket
container (5) Versions 0.2.0 Follow1
Installs lxc and offers containers as resource
cookbook 'container', '= 0.2.0'
knife cookbook site install container
knife cookbook site download container
This cookbook provides chef gears for installing and managing linux containers. You can use this cookbook following ways:
- container - resource/provider to create privileged container
- container_user - resource/provider to create an user who can create containers (unprivileged container).
These resource providers require native ruby-lxc bindings (installed by container::ruby recipe).
Note: Container cookbook is only tested on ubuntu 14.04.
Following will create a privileged ubuntu container named
And following will create and start a ubuntu 10.04 container
container 'test-2' do
options(template: 'ubuntu', template_options: ['-r lucid'])
action [:create, :start]
container resource can have following actions:
- create default
And following attributes - container_name name attribute, default to resource name - options a hash of action specific parameters
The options attribute can take following parameters (as hash)
- for create action:
- template: name of the template that will be used for creating the container (e.g. ubuntu, fedora, oracle etc). Default is ubuntu.
- template_options: an array containing addiotional arguments that will be passed to template (use
lxc-create -t foo --help to get the list of supported options for individual templates). Default is an empty array
- block_device: The backing storage device (e.g lvm, zfs etc). Default is nil
- flags: An integer flag passed to lxc-crate (currently only LXC::LXC_CREATE_QUIET is available)
This resource/provider setup necessary configuration files and folders required to create unprivilged containers (containers that are not owned by root).
Following will create an user named
foo with '/opt/foo' as home directory, who can create containers.
container_user 'foo' do home_dir '/opt/foo' end
container_user resource can have following attributes:
- user name of the user
- user_password shadow password of the user
- create_user whetere the user will be created or an existing user will be used
- home_dir home directory of the user. Containers will be stored under this directory
- veth_limit number the veth interfaces that this user can create for containers (default is 100, which means by default 100 containers can be created by this user, assuming each of them will have 1 veth interface).
container_user only allows
container::ruby recipe installs chef-lxc
gem which also allowis creation of containers via the
lxc resource or chef-lxc
command line binary. But unlike the
container resource provided by this cookbook
lxc resource can also configure containers (packages, services etc) using the same
chef recipe, but without actually installing chef inside it.
lxc "web" do template "ubuntu" recipe do package "apache2" service "apache2" do action [:start, :enable] end end action [:create, :start] end
If you want to install chef inside a container to configure it, you should look at chef-provisioning-lxc.
- Fork it ( https://github.com/GoatOS/container/fork )
- 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 a new Pull Request
This cookbook has no specified dependencies.
0.2.0 passed this metric
0.2.0 passed this metric