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

docker (431) Versions 0.25.0

Provides docker_service, docker_image, and docker_container resources

Policyfile
Berkshelf
Knife
cookbook 'docker', '= 0.25.0', :supermarket
cookbook 'docker', '= 0.25.0'
knife supermarket install docker
knife supermarket download docker
README
Dependencies
Quality -%

chef-docker Build Status

Description

Installs/Configures Docker. Please see [COMPATIBILITY.md](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

Chef

  • Chef 11+

Platforms

  • CentOS 6
  • Debian 7 (experimental)
  • Fedora 19
  • Fedora 20
  • Oracle 6 (experimental)
  • RHEL 6
  • Ubuntu 12.04
  • Ubuntu 12.10
  • Ubuntu 13.04
  • Ubuntu 13.10 (experimental)

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
registry_cmd_timeout registry LWRP default cmd_timeout seconds Fixnum 60
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: container operations
  • docker_image: image/repository operations
  • docker_registry: registry operations

Getting Started

Here's a quick example of pulling the latest image and running a container with exposed ports (creates service automatically):

# Pull latest image
docker_image 'samalba/docker-registry'

# Run container exposing ports
docker_container 'samalba/docker-registry' do
  detach true
  port '5000:5000'
  env 'SETTINGS_FLAVOR=local'
  volume '/mnt/docker:/docker-storage'
end

Maybe you want to automatically update your private registry with changes from your container?

# Login to private registry
docker_registry 'https://docker-registry.example.com/' do
  username 'shipper'
  password 'iloveshipping'
end

# Pull tagged image
docker_image 'apps/crowsnest' do
  tag 'not-latest'
end

# Run container
docker_container 'crowsnest'

# Save current timestamp
timestamp = Time.new.strftime('%Y%m%d%H%M')

# Commit container changes
docker_container 'crowsnest' do
  repository 'apps'
  tag timestamp
  action :commit
end

# Push image
docker_image 'crowsnest' do
  repository 'apps'
  tag timestamp
  action :push
end

See full documentation for each LWRP and action below for more information.

docker_container

Below are the available actions for the LWRP, default being run.

These attributes are associated with all LWRP actions.

Attribute Description Type Default
cmd_timeout Timeout for docker commands (catchable exception: Chef::Provider::Docker::Container::CommandTimeout) Integer node['docker']['container_cmd_timeout']
command Command to run in or identify container String nil
container_name Name for container/service String nil

commit

These attributes are associated with this LWRP action.

Attribute Description Type Default
author Author for commit String nil
message Message for commit String nil
repository Remote repository String nil
tag Specific tag for image String nil

Commit a container with optional repository and tag:

docker_container 'myApp' do
  repository 'myRepo'
  tag Time.new.strftime("%Y%m%d%H%M")
  action :commit
end

cp

These attributes are associated with this LWRP action.

Attribute Description Type Default
destination Host path to copy file String nil
source Container path to get file String nil

Copying a file from container to host:

docker_container 'myApp' do
  source '/path/to/container/file'
  destination '/path/to/save/on/host'
  action :cp
end

export

These attributes are associated with this LWRP action.

Attribute Description Type Default
destination Host path to save tarball String nil

Exporting container to host:

docker_container 'myApp' do
  destination '/path/to/save/on/host.tgz'
  action :export
end

kill

These attributes are associated with this LWRP action.

Attribute Description Type Default
cookbook Cookbook to grab any templates String docker
init_type Init type for container service handling FalseClass, String node['docker']['container_init_type']
init_template Template to use for init configuration String nil
socket_template Template to use for configuring socket (relevent for init_type systemd only) String nil

Kill a running container:

docker_container 'shipyard' do
  action :kill
end

remove

These attributes are associated with this LWRP action.

Attribute Description Type Default
cookbook Cookbook to grab any templates String docker
init_type Init type for container service handling FalseClass, String node['docker']['container_init_type']
init_template Template to use for init configuration String nil
link Add link to another container String, Array nil
socket_template Template to use for configuring socket (relevent for init_type systemd only) String nil

Remove a container:

docker_container 'shipyard' do
  action :remove
end

restart

These attributes are associated with this LWRP action.

Attribute Description Type Default
cookbook Cookbook to grab any templates String docker
init_type Init type for container service handling FalseClass, String node['docker']['container_init_type']
init_template Template to use for init configuration String nil
socket_template Template to use for configuring socket (relevent for init_type systemd only) String nil

Restart a container:

docker_container 'shipyard' do
  action :restart
end

run

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 associated with this LWRP action.

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
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
image Image for container String LWRP name
init_type Init type for container service handling FalseClass, String node['docker']['container_init_type']
init_template Template to use for init configuration String nil
link Add link to another container String, Array 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
socket_template Template to use for configuring socket (relevent for init_type systemd only) String 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 'myImage' do
  detach true
end

Run a container via command:

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

start

These attributes are associated with this LWRP action.

Attribute Description Type Default
attach Attach container's stdout/stderr and forward all signals to the cookbook Cookbook to grab any templates String
init_type Init type for container service handling FalseClass, String node['docker']['container_init_type']
init_template Template to use for init configuration String nil
socket_template Template to use for configuring socket (relevent for init_type systemd only) String nil
stdin Attach container's stdin TrueClass, FalseClass nil

Start a stopped container:

docker_container 'shipyard' do
  action :start
end

stop

These attributes are associated with this LWRP action.

Attribute Description Type Default
cookbook Cookbook to grab any templates String docker
init_type Init type for container service handling FalseClass, String node['docker']['container_init_type']
init_template Template to use for init configuration String nil
socket_template Template to use for configuring socket (relevent for init_type systemd only) String nil

Stop a running container:

docker_container 'shipyard' do
  action :stop
end

wait

Wait for a container to finish:

docker_container 'busybox' do
  command 'sleep 9999'
  action :wait
end

docker_image

Below are the available actions for the LWRP, default being pull.

These attributes are associated with all LWRP actions.

Attribute Description Type Default
cmd_timeout Timeout for docker commands (catchable exception: Chef::Provider::Docker::Image::CommandTimeout) Integer node['docker']['image_cmd_timeout']

build

These attributes are associated with this LWRP action.

Attribute Description Type Default
dockerfile (DEPRECATED) Dockerfile to build image String nil
image_url (DEPRECATED) URL to grab image String nil
path (DEPRECATED) Local path to files String nil
source Source dockerfile/directory/URL to build String nil
tag Optional tag for image String nil

Build image from Dockerfile:

docker_image 'myImage' do
  tag 'myTag'
  source 'myImageDockerfile'
  action :build
end

Build image from remote repository:

docker_image 'myImage' do
  source 'example.com/foo/myImage'
  tag 'myTag'
  action :build
end

import

These attributes are associated with this LWRP action.

Attribute Description Type Default
image_url (DEPRECATED) URL to grab image String nil
repository Optional repository String nil
source Source file/directory/URL String nil
tag Optional tag for image String nil

Import image from local directory:

docker_image 'test' do
  source '/path/to/test'
  action :import
end

Import image from local file:

docker_image 'test' do
  source '/path/to/test.tgz'
  action :import
end

Import image from remote URL:

docker_image 'test' do
  source 'https://example.com/testimage.tgz'
  action :import
end

insert

These attributes are associated with this LWRP action.

Attribute Description Type Default
destination Destination path/URL String nil
source Source path/URL String nil

Insert file from remote URL:

docker_image 'test' do
  source 'http://example.com/some/file.txt'
  destination '/container/path/for/some/file.txt'
  action :insert
end

load

These attributes are associated with this LWRP action.

Attribute Description Type Default
source Source path/URL String nil

Load repository from path:

docker_image 'test' do
  source '/path/to/test.tgz'
  action :load
end

pull

These attributes are associated with this LWRP action.

Attribute Description Type Default
registry Optional registry server String nil
tag Optional tag for image String nil

Pull latest image:

docker_image 'busybox'

Pull tagged image:

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

push

Push image (after logging in with docker_registry):

docker_image 'bflad/test' do
  action :push
end

remove

Remove image:

docker_image 'busybox' do
  action :remove
end

save

These attributes are associated with this LWRP action.

Attribute Description Type Default
destination Destination path String nil

Save repository to path:

docker_image 'test' do
  destination '/path/to/test.tgz'
  action :save
end

tag

These attributes are associated with this LWRP action.

Attribute Description Type Default
force Force operation Boolean false
repository Remote repository String nil
tag Specific tag for image String nil

Tag image:

docker_image 'test' do
  repository 'bflad'
  tag '1.0.0'
  action :tag
end

docker_registry

These attributes are associated with all LWRP actions.

Attribute Description Type Default
cmd_timeout Timeout for docker commands (catchable exception: Chef::Provider::Docker::Registry::CommandTimeout) Integer node['docker']['registry_cmd_timeout']

login

These attributes are associated with this LWRP action.

Attribute Description Type Default
email Registry email String nil
password Registry password String nil
username Registry username String nil

Log into public registry:

docker_registry 'https://index.docker.io/v1/' do
  username 'publicme'
  password 'hope_this_is_in_encrypted_databag'
end

Log into private registry with optional port:

docker_registry 'https://docker-registry.example.com:8443/' do
  username 'privateme'
  password 'still_hope_this_is_in_encrypted_databag'
end

Register with registry:

docker_registry 'https://index.docker.io/v1/' do
  email 'publicme@example.com'
  username 'publicme'
  password 'hope_this_is_in_encrypted_databag'
end

Usage

Default Installation

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

Testing and Development

  • Quickly testing with Vagrant: [VAGRANT.md](VAGRANT.md)
  • Full development and testing workflow with Test Kitchen and friends: [TESTING.md](TESTING.md)

Contributing

Please see contributing information in: [CONTRIBUTING.md](CONTRIBUTING.md)

Maintainers

License

Please see licensing information in: [LICENSE](LICENSE)

Dependent cookbooks

apt >= 0.0.0
git >= 0.0.0
golang >= 0.0.0
lxc >= 1.1.6
modules >= 0.0.0
sysctl >= 0.0.0
yum-epel >= 0.0.0

Contingent cookbooks

amazon-ecs-agent Applicable Versions
arcgis-notebooks Applicable Versions
bastion Applicable Versions
cadvisor Applicable Versions
codenamephp_docker Applicable Versions
codenamephp_localmail Applicable Versions
containership Applicable Versions
cookbook-openshift3 Applicable Versions
cookbook-openshift3 2.0.5
cookbook-openshift3 2.0.6
cookbook-openshift3 2.0.7
cookbook-openshift3 2.0.9
cookbook-openshift3 2.0.10
cookbook-openshift3 2.0.12
cookbook-openshift3 2.0.13
cookbook-openshift3 2.0.14
cookbook-openshift3 2.0.15
cookbook-openshift3 2.0.18
cookbook-openshift3 2.0.19
cookbook-openshift3 2.0.20
cookbook-openshift3 2.0.21
cookbook-openshift3 2.0.22
cookbook-openshift3 2.0.23
cookbook-openshift3 2.0.24
cookbook-openshift3 2.0.26
cookbook-openshift3 2.0.27
cookbook-openshift3 2.0.28
cookbook-openshift3 2.0.29
cookbook-openshift3 2.0.32
cookbook-openshift3 2.0.33
cookbook-openshift3 2.0.41
cookbook-openshift3 2.0.42
cookbook-openshift3 2.0.43
cookbook-openshift3 2.0.44
cookbook-openshift3 2.0.45
cookbook-openshift3 2.0.46
cookbook-openshift3 2.0.47
cookbook-openshift3 2.0.48
cookbook-openshift3 2.0.49
cookbook-openshift3 2.0.50
cookbook-openshift3 2.0.51
cookbook-openshift3 2.0.52
cookbook-openshift3 2.0.53
cookbook-openshift3 2.0.54
cookbook-openshift3 2.0.55
cookbook-openshift3 2.0.57
cookbook-openshift3 2.0.58
cookbook-openshift3 2.0.60
cookbook-openshift3 2.0.62
cookbook-openshift3 2.0.63
cookbook-openshift3 2.0.64
cookbook-openshift3 2.0.65
cookbook-openshift3 2.0.66
cookbook-openshift3 2.0.68
cookbook-openshift3 2.0.69
cookbook-openshift3 2.0.71
cookbook-openshift3 2.0.72
cookbook-openshift3 2.0.74
cookbook-openshift3 2.0.75
cookbook-openshift3 2.0.76
cookbook-openshift3 2.0.77
cookbook-openshift3 2.0.82
cookbook-openshift3 2.0.83
cookbook-openshift3 2.0.85
cookbook-openshift3 2.0.86
cookbook-openshift3 2.0.88
cookbook-openshift3 2.0.90
cookbook-openshift3 2.1.0
cookbook-openshift3 2.1.1
cookbook-openshift3 2.1.2
cookbook-openshift3 2.1.3
cookbook-openshift3 2.1.4
cookbook-openshift3 2.1.5
cookbook-openshift3 2.1.6
cookbook-openshift3 2.1.7
cookbook-openshift3 2.1.8
cookbook-openshift3 2.1.9
cookbook-openshift3 2.1.11
cookbook-openshift3 2.1.13
cookbook-openshift3 2.1.14
cookbook-openshift3 2.1.17
cookbook-openshift3 2.1.18
cookbook-openshift3 2.1.19
cookbook-openshift3 2.1.21
cookbook-openshift3 2.1.23
cookbook-openshift3 2.1.24
cookbook-openshift3 2.1.25
cookbook-openshift3 2.1.26
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
docker_stack Applicable Versions
dokku Applicable Versions
drone Applicable Versions
drone_app Applicable Versions
elite Applicable Versions
etcd Applicable Versions
gliderlabs_registrator Applicable Versions
harbor 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
mydocker Applicable Versions
netdevops Applicable Versions
rancher Applicable Versions
rancher-ha Applicable Versions
rancher-ng Applicable Versions
sdlc_structure Applicable Versions
sdlc_structure 0.1.12
sdlc_structure 0.2.1
sdlc_structure 0.3.1
sdlc_structure 0.4.1
sdlc_structure 0.5.1
sdlc_structure 0.6.1
sdlc_structure 0.7.1
sdlc_structure 0.8.1
sdlc_structure 0.9.1
sdlc_structure 0.10.1
sdlc_structure 0.11.1
sdlc_structure 0.12.1
sdlc_structure 0.13.1
sdlc_structure 0.14.2
sdlc_structure 0.15.1
sdlc_structure 0.16.1
sdlc_structure 0.17.1
sdlc_structure 0.18.1
sdlc_structure 0.19.1
sdlc_structure 0.20.1
sdlc_structure 0.21.1
sdlc_structure 0.22.1
sdlc_structure 0.23.1
sdlc_structure 0.24.1
sdlc_structure 0.25.1
sdlc_structure 0.26.1
sdlc_structure 0.27.1
sdlc_structure 0.28.1
sdlc_structure 0.29.1
sdlc_structure 0.30.1
sdlc_structure 0.31.1
sdlc_structure 0.32.1
sdlc_structure 0.33.1
sdlc_structure 0.34.1
sdlc_structure 0.35.1
sdlc_structure 0.36.1
sdlc_structure 0.37.1
sdlc_structure 0.38.1
sdlc_structure 0.39.1
sdlc_structure 0.40.1
sdlc_structure 0.41.1
sdlc_structure 0.42.1
sdlc_structure 0.43.1
sdlc_structure 0.44.1
sdlc_structure 0.45.1
sdlc_structure 0.46.1
sdlc_structure 0.47.1
sdlc_structure 0.48.1
sdlc_structure 0.49.1
sdlc_structure 0.50.1
sdlc_structure 0.51.1
sdlc_structure 0.52.1
sdlc_structure 0.53.1
sdlc_structure 0.54.1
sdlc_structure 0.55.1
sdlc_structure 0.56.1
sdlc_structure 0.57.1
sdlc_structure 0.58.1
sdlc_structure 0.59.1
sdlc_structure 0.60.1
sdlc_structure 0.61.1
sdlc_structure 0.62.1
sdlc_structure 0.63.1
sdlc_structure 0.64.1
sdlc_structure 0.65.1
sdlc_structure 0.66.1
sdlc_structure 0.67.1
sdlc_structure 0.68.1
sdlc_structure 0.69.1
sdlc_structure 0.70.1
sdlc_structure 0.71.1
sdlc_structure 0.72.1
sdlc_structure 0.73.1
sdlc_structure 0.74.1
sdlc_structure 0.75.1
sdlc_structure 0.76.1
sdlc_structure 0.77.1
sdlc_structure 0.78.1
sdlc_structure 0.79.1
sdlc_structure 0.80.1
sdlc_structure 0.81.1
sdlc_structure 0.82.1
sdlc_structure 0.83.1
sdlc_structure 0.84.1
sdlc_structure 0.85.1
sdlc_structure 0.86.1
sdlc_structure 0.87.1
sdlc_structure 0.88.1
sdlc_structure 0.89.1
sdlc_structure 0.90.1
sdlc_structure 0.91.1
sdlc_structure 0.92.1
sdlc_structure 0.93.1
sdlc_structure 0.94.1
sdlc_structure 0.95.1
sdlc_structure 0.96.1
sdlc_structure 0.97.1
sdlc_structure 0.98.1
sdlc_structure 0.99.1
sdlc_structure 0.100.1
sdlc_structure 0.101.1
sdlc_structure 0.102.1
sdlc_structure 0.103.1
sdlc_structure 0.104.1
sdlc_structure 0.105.1
sdlc_structure 0.106.1
sdlc_structure 0.107.1
sdlc_structure 0.108.1
sdlc_structure 0.109.1
sdlc_structure 0.110.1
sdlc_structure 0.111.1
sdlc_structure 0.112.1
sdlc_structure 0.113.1
sdlc_structure 0.114.1
singularity Applicable Versions
stack-logger Applicable Versions
swarm Applicable Versions
tfc_agent Applicable Versions
vulcand Applicable Versions
weave Applicable Versions

No quality metric results found