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

RSS

docker (278) Versions 0.20.0

Provides docker_service, docker_image, and docker_container resources

Berkshelf/Librarian
Policyfile
Knife
cookbook 'docker', '= 0.20.0'
cookbook 'docker', '= 0.20.0', :supermarket
knife cookbook site install docker
knife cookbook site download docker
README
Dependencies
Quality

chef-docker Build Status

Description

Installs/Configures Docker. Please see COMPATIBILITY.md for more information about Docker versions that are tested and supported by cookbook versions along with LWRP features.

This cookbook was inspired by @thoward's docker-cookbook: https://github.com/thoward/docker-cookbook

Requirements

Platforms

  • CentOS 6
  • Fedora 19
  • Fedora 20
  • Oracle 6
  • RHEL 6
  • Ubuntu 12.04
  • Ubuntu 12.10
  • Ubuntu 13.04

Cookbooks

Opscode Cookbooks

Third-Party Cookbooks

Attributes

These attributes are under the node['docker'] namespace.

Attribute Description Type Default
arch Architecture for docker binary (note: Docker only currently supports x86_64) String auto-detected (see attributes/default.rb)
bind_socket Socket path that docker should bind String unix:///var/run/docker.sock
bind_uri TCP URI docker should bind String nil
container_cmd_timeout container LWRP default cmd_timeout seconds Fixnum 60
container_init_type Init type for docker containers (nil, "systemd", or "upstart") NilClass or String node['docker']['init_type']
http_proxy HTTP_PROXY environment variable String nil
image_cmd_timeout image LWRP default cmd_timeout seconds Fixnum 300
init_type Init type for docker ("systemd", "sysv", or "upstart") String auto-detected (see attributes/default.rb)
install_dir Installation directory for docker binary String auto-detected (see attributes/default.rb)
install_type Installation type for docker ("binary", "package" or "source") String "package"
options Additional options to pass to docker. These could be flags like "-api-enable-cors". String nil
version Version of docker String nil

Binary Attributes

These attributes are under the node['docker']['binary'] namespace.

Attribute Description Type Default
version Version of docker binary String `node['docker']['version']
url URL for downloading docker binary String auto-detected (see attributes/default.rb)

Package Attributes

These attributes are under the node['docker']['package'] namespace.

Attribute Description Type Default
distribution Distribution for docker packages String auto-detected (see attributes/default.rb)
repo_url Repository URL for docker packages String auto-detected (see attributes/default.rb)

Source Attributes

These attributes are under the node['docker']['source'] namespace.

Attribute Description Type Default
ref Repository reference for docker source String "master"
url Repository URL for docker source String "https://github.com/dotcloud/docker.git"

Recipes

  • recipe[docker] Installs/Configures Docker
  • recipe[docker::aufs] Installs/Loads AUFS Linux module
  • recipe[docker::binary] Installs Docker binary
  • recipe[docker::cgroups] Installs/configures default platform Control Groups support
  • recipe[docker::lxc] Installs/configures default platform LXC support
  • recipe[docker::package] Installs Docker via package
  • recipe[docker::source] Installs Docker via source
  • recipe[docker::systemd] Installs/Starts Docker via systemd
  • recipe[docker::sysv] Installs/Starts Docker via SysV
  • recipe[docker::upstart] Installs/Starts Docker via Upstart

LWRPs

docker_container

By default, this will handle creating a service for the container when action is run or start. set['docker']['container_init_type'] = false or add init_type false for LWRP to disable this behavior.

These attributes are under the docker_container LWRP namespace.

Attribute Description Type Default
attach Attach container's stdout/stderr and forward all signals to the process TrueClass, FalseClass nil
cidfile File to store container ID String nil
cmd_timeout Timeout for docker commands Integer node['docker']['container_cmd_timeout']
command Command to run in container String nil
container_name Name for container/service String nil
cookbook Cookbook to grab any templates String docker
cpu_shares CPU shares for container Fixnum nil
detach Detach from container when starting TrueClass, FalseClass nil
dns DNS servers for container String, Array nil
entrypoint Overwrite the default entrypoint set by the image String nil
env Environment variables to pass to container String, Array nil
expose Expose a port from the container without publishing it to your host Fixnum, String, Array nil
hostname Container hostname String nil
id Container ID (internally set by LWRP) String nil
image Image for container String LWRP name
init_type Init type for container service handling FalseClass, String node['docker']['container_init_type']
link Add link to another container String nil
lxc_conf Custom LXC options String, Array nil
memory Set memory limit for container Fixnum nil
port Map network port(s) to the container Fixnum (DEPRECATED), String, Array nil
privileged Give extended privileges TrueClass, FalseClass nil
public_port (DEPRECATED) Map host port to container Fixnum nil
publish_exposed_ports Publish all exposed ports to the host interfaces TrueClass, FalseClass false
remove_automatically Automatically remove the container when it exits (incompatible with detach) TrueClass, FalseClass false
running Container running status (internally set by LWRP) TrueClass, FalseClass nil
stdin Attach container's stdin TrueClass, FalseClass nil
tty Allocate a pseudo-tty TrueClass, FalseClass nil
user User to run container String nil
volume Create bind mount(s) with: [host-dir]:[container-dir]:[rw ro]. If "container-dir" is missing, then docker creates a new volume. String, Array
volumes_from Mount all volumes from the given container(s) String nil
working_directory Working directory inside the container String nil

Run a container:

docker_container "busybox" do
  command "sleep 9999"
  detach true
end

Run a container from image (docker-registry for example):

docker_container "docker-registry" do
  image "samalba/docker-registry"
  detach true
  hostname "xx.xx.xx.xx"
  port 5000
  env "SETTINGS_FLAVOR=local"
  volume "/mnt/docker:/docker-storage"
end

Stop a running container:

docker_container "busybox" do
  command "sleep 9999"
  action :stop
end

Start a stopped container:

docker_container "busybox" do
  command "sleep 9999"
  action :start
end

Restart a container:

docker_container "busybox" do
  command "sleep 9999"
  action :restart
end

Remove a container:

docker_container "busybox" do
  command "sleep 9999"
  action :remove
end

docker_image

These attributes are under the docker_image LWRP namespace.

Attribute Description Type Default
cmd_timeout Timeout for docker commands Integer node['docker']['image_cmd_timeout']
dockerfile Dockerfile to build image String nil
id Image ID (internally set by LWRP) String nil
image_name Image name String LWRP name
image_url URL to grab image String nil
installed Image installation status (internally set by LWRP) TrueClass, FalseClass nil
installed_tag - String nil
path Local path to files String nil
registry Registry server String nil
repository Remote repository String nil
tag Specific tag for image String nil

Build image from Dockerfile:

docker_image "myImage" do
  tag "myTag"
  dockerfile myImageDockerfile
  action :build
end

Build image from remote repository:

docker_image "myImage" do
  image_url "example.com/foo/myImage"
  tag "myTag"
  action :build
end

Pull latest image:

docker_image "busybox"

Pull tagged image:

docker_image "bflad/test" do
  tag "not-latest"
end

Import image from URL:

docker_image "test" do
  image_url "https://example.com/testimage.tgz"
  action :import
end

Import image from URL with repository/tag information:

docker_image "test" do
  repository "bflad/test"
  tag "not-latest"
  action :import
end

Remove image:

docker_image "busybox" do
  action :remove
end

Usage

Default Installation

  • Add recipe[docker] to your node's run list

Testing and Development

Vagrant

Here's how you can quickly get testing or developing against the cookbook thanks to Vagrant and Berkshelf.

vagrant plugin install vagrant-berkshelf
vagrant plugin install vagrant-cachier
vagrant plugin install vagrant-omnibus
git clone git://github.com/bflad/chef-docker.git
cd chef-docker
vagrant up BOX # BOX being centos6, debian7, fedora18, fedora19, ubuntu1204, ubuntu1210, or ubuntu1304

You can then SSH into the running VM using the vagrant ssh BOX command.

The VM can easily be stopped and deleted with the vagrant destroy command. Please see the official Vagrant documentation for a more in depth explanation of available commands.

Test Kitchen

Please see documentation in: TESTING.md

Contributing

Please use standard Github issues/pull requests and if possible, in combination with testing on the Vagrant boxes or Test Kitchen suite.

Maintainers

License

Please see licensing information in: LICENSE

Dependent cookbooks

yum >= 0.0.0
modules >= 0.0.0
lxc >= 0.0.0
golang >= 0.0.0
git >= 0.0.0
apt >= 0.0.0

Contingent cookbooks

amazon-ecs-agent Applicable Versions
bastion Applicable Versions
cadvisor Applicable Versions
containership Applicable Versions
corbel Applicable Versions
dcos Applicable Versions
deis Applicable Versions
docker-docker-registry Applicable Versions
docker-mms Applicable Versions
docker-mongodb Applicable Versions
docker-mongodb-replset-configurator Applicable Versions
docker-nginx Applicable Versions
docker-nodejs Applicable Versions
docker-platform Applicable Versions
docker-pm2 Applicable Versions
docker-python Applicable Versions
docker-redis Applicable Versions
docker2host Applicable Versions
docker_rancher Applicable Versions
docker_registry Applicable Versions
dokku Applicable Versions
drone Applicable Versions
drone_app Applicable Versions
elite Applicable Versions
etcd Applicable Versions
gliderlabs_registrator Applicable Versions
jmccann-docker-host Applicable Versions
kubernetes Applicable Versions
kubernetes-install Applicable Versions
kubernetes-mesos Applicable Versions
mediawiki Applicable Versions
mesos Applicable Versions
mw_php_fpm Applicable Versions
netdevops Applicable Versions
rancher Applicable Versions
rancher-ng Applicable Versions
singularity Applicable Versions
stack-logger Applicable Versions
swarm Applicable Versions
vulcand Applicable Versions
weave Applicable Versions

No quality metric results found