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


lxc (11) Versions 2.0.0

Chef driven Linux Containers

cookbook 'lxc', '~> 2.0.0'
cookbook 'lxc', '~> 2.0.0', :supermarket
knife cookbook site install lxc
knife cookbook site download lxc
Quality 33%


Manage linux containers with Chef.


Test this cookbook before applying to existing nodes. Lots of updates have been applied, and some tooling has been replaced. Also, rhel is working in a pretty hacky way, so use at your own risk. YOLO!



Installs the packages and configuration files needed for lxc on the server. If the node uses apt-cacher-ng as a client, the server will be reused when building containers.


Installs the packages needed to support lxc's containers.


This recipe creates all of the containers defined in the ['lxc']['containers'] hash. Here is an example of an example container:

node['lxc']['containers']['example'] = {
  'template' => 'ubuntu',
  'initialize_commands' => ['apt-get update']


Install and manage containers via the knife-remotelxc plugin.


Installs lxc packages


Configures lxc services



Allows for creation, deletion, and cloning of containers


Allows configuration of the LXC configuration file


Allows defining mounts to be used within the container


Allows configurations of network interfaces within a container


Run a command within an ephemeral container


Creates a container using the lxc LWRP and configures the container as requested. This resource also allows nesting lxc_fstab and lxc_interface within the container resource.


include_recipe 'lxc'

lxc_container 'my_container' do
  action :create
  validation_client 'my-validator'
  server_uri ''
  validator_pem content_from_encrypted_dbag
  run_list ['role[base]']
  chef_enabled true
  fstab_mount "Persist" do
    file_system '/opt/file_store'
    mount_point '/opt/file_store'
    type 'none'
    options 'bind,rw'

lxc_container 'my_container_clone' do
  action :create
  clone 'my_container'
  chef_enabled true

lxc_service 'my_container_clone' do
  action :start

Containers do not have to be Chef enabled but it does make them extremely easy to configure. If you want the Omnibus installer cached, you can set the attribute

node['omnibus_updater']['cache_omnibus_installer'] = true

in a role or environment (default is false). The lxc_container resource also provides initialize_commands which an array of commands can be provided that will be run after the container is created.




  • Remove apt-cacher. Use polipo.
  • Update network configurations
  • Remove dpkg options on package install
  • Only use apparmor helper on ubuntu
  • Set auto on all interfaces
  • Fix up container setup command checks
  • Set up hacky support on RHEL family (still needs cleanup)


  • Bug fix release: Upgrades elecksee gem to 1.0.20 minimum (#45)


  • Fix data bag secret copy (thanks @jbianquetti)
  • Support upstart based services (thanks @bkw)
  • Update minimum version for elecksee helper gem


  • Use latest omnibus deb for chef install within containers
  • Apt cacher related fixes
  • Handful of bug fixes


  • Update lxc package installation to accept existing configuration file
  • Add missing -n option in destroy action for LWRP (thanks @sanders)


  • Use elecksee gem for Lxc interaction
  • Add ephemeral LWRP
  • Allow AppArmor configuration
  • Unset default container passwords
  • Allow nesting LWRPs
  • Use dpkg_autostart and config ordering to allow lxc installation on hosts with 10.0.0.x address space in use
  • Remove deprecated lxc-awesome-ephemeral script by default


  • Extract container actions out to new LWRP lxc
  • Update container to use lxc resource for container actions
  • Update container to allow nested subresources for interface and fstab_mount
  • Fix interface LWRP to allow IPv6 based values
  • Remove static_ip config set as it was introducing bogus route
  • Provide assumed environment when not available (like when running via runit)
  • Make chef enabled containers properly idempotent
  • Clean up the container provider implementation to be more resource based
  • Add ephemeral LWRP
  • Add custom ephemeral script to allow host directory overlay or virtual block device
  • Patches execute resource to provide streaming output
  • Updates Lxc library to be more reusable
  • Add proc based network detection for more robust address discovery
  • Shell out directly to ssh for container commands instead of using knife ssh


  • Abstracted out packages for cross-platform support later.
  • Added the 'containers' recipe to create containers for the members of the node['lxc']['containers'] hash
  • Add support for use of the apt::cacher-client settings if a proxy is in use.
  • chef_enabled defaults to false on lxc_containers
  • Better idempotency checks when building new containers
  • Refactoring of lxc_service
  • Container based commands run via knife::ssh providing proper logging feedback
  • New networking related attributes added to lxc_container for easy basic network setups


  • Remove resource for deprecated template


  • Cleanup current config and container LWRPs
  • Add new LWRPs (fstab and interface)
  • Add better configuration build to prevent false updates
  • Thanks to Sean Porter ( for help debugging LWRP updates


  • Initial release

Collaborator Number Metric

2.0.0 failed this metric

Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.

Contributing File Metric

2.0.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of, and your repo must contain a file

Foodcritic Metric

2.0.0 failed this metric

FC007: Ensure recipe dependencies are reflected in cookbook metadata: lxc/recipes/install_dependencies.rb:14
FC021: Resource condition in provider may not behave as expected: lxc/providers/container.rb:110
FC021: Resource condition in provider may not behave as expected: lxc/providers/container.rb:260
FC022: Resource condition within loop may not behave as expected: lxc/providers/container.rb:176
FC047: Attribute assignment does not specify precedence: lxc/recipes/knife.rb:4
FC052: Metadata uses the deprecated "suggests" keyword: lxc/metadata.rb:9
FC052: Metadata uses the deprecated "suggests" keyword: lxc/metadata.rb:10
FC064: Ensure issues_url is set in metadata: lxc/metadata.rb:1
FC065: Ensure source_url is set in metadata: lxc/metadata.rb:1
FC066: Ensure chef_version is set in metadata: lxc/metadata.rb:1
FC067: Ensure at least one platform supported in metadata: lxc/metadata.rb:1
FC069: Ensure standardized license defined in metadata: lxc/metadata.rb:1
FC104: Use the :run action in ruby_block instead of :create: lxc/providers/container.rb:247
Run with Foodcritic Version 13.0.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any

License Metric

2.0.0 passed this metric

No Binaries Metric

2.0.0 passed this metric

Publish Metric

2.0.0 passed this metric

Supported Platforms Metric

2.0.0 failed this metric

lxc should declare what platform(s) it supports.

Testing File Metric

2.0.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of, and your repo must contain a file

Version Tag Metric

2.0.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of, and your repo must include a tag that matches this cookbook version number