Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status

RSS

container (5) Versions 0.3.0

Installs lxc and offers containers as resource

Policyfile
Berkshelf
Knife
cookbook 'container', '= 0.3.0', :supermarket
cookbook 'container', '= 0.3.0'
knife supermarket install container
knife supermarket download container
README
Dependencies
Quality 100%

Container cookbook

Chef cookbook for managing linux containers.

Description

This cookbook provides chef gears for installing and managing linux
containers. You can use this cookbook following ways:

  1. Recipes
    • container::install recipe installs lxc and related packages
    • container::ruby recipe installs ruby-lxc and chef-lxc gems.
  2. Resource-Providers
    • 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.

Usage

container resource

Following will create a privileged ubuntu container named test-1

container 'test-1'

And following will create and start a ubuntu 10.04 container
ruby
container 'test-2' do
options(template: 'ubuntu', template_options: ['-r lucid'])
action [:create, :start]
end

container resource can have following actions:
- create default
- destroy
- start
- stop

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)

container_user resource

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 setup action

Chef-Lxc offerings

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.

License

Apache 2

Contributing

  1. Fork it ( https://github.com/GoatOS/container/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Dependent cookbooks

This cookbook has no specified dependencies.

Contingent cookbooks

goatos Applicable Versions

Foodcritic Metric
            

0.3.0 passed this metric