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.1.1
-
4.1.0
-
4.0.2
-
4.0.1
-
4.0.0
-
3.0.0
-
2.17.0
-
2.16.4
-
2.16.3
-
2.16.2
-
2.16.1
-
2.16.0
-
2.15.29
-
2.15.28
-
2.15.27
-
2.15.26
-
2.15.25
-
2.15.24
-
2.15.23
-
2.15.22
-
2.15.21
-
2.15.20
-
2.15.19
-
2.15.18
-
2.15.17
-
2.15.16
-
2.15.15
-
2.15.14
-
2.15.13
-
2.15.12
-
2.15.11
-
2.15.10
-
2.15.9
-
2.15.8
-
2.15.7
-
2.15.6
-
2.15.5
-
2.15.4
-
2.15.3
-
2.15.2
-
2.15.1
-
2.15.0
-
2.14.4
-
2.14.3
-
2.14.2
-
2.14.1
-
2.14.0
-
2.13.11
-
2.13.10
-
2.13.9
-
2.13.8
-
2.13.7
-
2.13.6
-
2.13.5
-
2.13.4
-
2.13.3
-
2.13.2
-
2.13.1
-
2.13.0
-
2.12.0
-
2.11.1
-
2.11.0
-
2.9.10
-
2.9.9
-
2.9.8
-
2.9.7
-
2.9.6
-
2.9.5
-
2.9.4
-
2.9.3
-
2.9.2
-
2.9.1
-
2.9.0
-
2.8.0
-
2.7.1
-
2.7.0
-
2.6.8
-
2.6.7
-
2.6.6
-
2.6.5
-
2.6.4
-
2.6.3
-
2.6.2
-
2.6.1
-
2.6.0
-
2.5.8
-
2.5.7
-
2.5.6
-
2.5.5
-
2.5.4
-
2.5.3
-
2.5.2
-
2.5.1
-
2.5.0
-
2.4.26
-
2.4.25
-
2.4.24
-
2.4.23
-
2.4.22
-
2.4.21
-
2.4.20
-
2.4.19
-
2.4.18
-
2.4.17
-
2.4.16
-
2.4.15
-
2.4.14
-
2.4.13
-
2.4.12
-
2.4.11
-
2.4.10
-
2.4.9
-
2.4.8
-
2.4.7
-
2.4.6
-
2.4.5
-
2.4.4
-
2.4.3
-
2.4.2
-
2.4.1
-
2.4.0
-
2.3.23
-
2.3.22
-
2.3.21
-
2.3.20
-
2.3.19
-
2.3.18
-
2.3.17
-
2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20
- 1.0.19
- 1.0.18
- 1.0.17
- 1.0.16
- 1.0.15
- 1.0.14
- 1.0.13
- 1.0.12
- 1.0.11
- 1.0.10
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- 0.43.0
- 0.42.0
- 0.41.0
- 0.40.3
- 0.40.2
- 0.40.1
- 0.40.0
- 0.37.0
- 0.36.0
- 0.35.2
- 0.35.1
- 0.35.0
- 0.34.2
- 0.34.1
- 0.34.0
- 0.33.1
- 0.33.0
- 0.32.2
- 0.32.1
- 0.32.0
- 0.31.0
- 0.30.2
- 0.30.1
- 0.30.0
- 0.29.0
- 0.28.0
- 0.27.1
- 0.27.0
- 0.26.0
- 0.25.1
- 0.25.0
- 0.24.2
- 0.24.1
- 0.24.0
- 0.23.1
- 0.23.0
- 0.22.0
- 0.21.0
- 0.20.0
- 0.19.1
- 0.19.0
- 0.18.1
- 0.18.0
- 0.17.0
- 0.16.0
- 0.15.0
- 0.14.0
- 0.13.0
- 0.12.0
- 0.11.0
- 0.10.1
- 0.10.0
- 0.9.1
- 0.9.0
- 0.8.1
- 0.8.0
- 0.7.1
- 0.6.2
- 0.6.1
- 0.6.0
- 0.5.0
- 0.4.0
- 0.3.0
- 0.2.0
- 0.1.0
Provides docker_service, docker_image, and docker_container resources
cookbook 'docker', '= 0.30.2', :supermarket
knife supermarket install docker
knife supermarket download docker
chef-docker
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
- Mac OS X (only docker installation currently)
- Oracle 6 (experimental)
- RHEL 6
- Ubuntu 12.04
- Ubuntu 12.10
- Ubuntu 13.04
- Ubuntu 13.10 (experimental)
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'] |
docker_daemon_timeout | Timeout to wait for the docker daemon to start in seconds | Fixnum | 10 |
group_members | Manage docker group members | Array of Strings | [] |
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 |
storage_type | Storage driver for docker (nil, "aufs", or "devmapper") | String | auto-detected (see attributes/default.rb) |
version | Version of docker | String | nil |
virtualization_type | Virtualization driver for docker (nil or "lxc") | String | auto-detected (see attributes/default.rb) |
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 | http://get.docker.io/builds/#{node['kernel']['name']}/#{node['docker']['arch']}/docker-#{node['docker']['binary']['version']} |
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::devmapper]
Installs/Configures Device Mapper -
recipe[docker::group]
Installs/Configures docker group -
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 |
docker_container action :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 |
run | Configuration to be applied when the image is launched with docker run
|
String | nil |
tag | Specific tag for image | String | nil |
Commit a container with optional repository, run specification, and tag:
docker_container 'myApp' do
repository 'myRepo'
tag Time.new.strftime("%Y%m%d%H%M")
run '{"Cmd": ["cat", "/world"], "PortSpecs": ["22"]}'
action :commit
end
docker_container action :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
docker_container action :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
docker_container action :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
docker_container action :redeploy
Stops, removes, and runs a container. Useful for notifications from image build/pull.
Attributes for this action can be found in the stop
, remove
, and run
actions.
Redeploy container when new image is pulled:
docker_image 'shipyard/shipyard' do action :pull notifies :redeploy, 'docker_container[shipyard]', :immediately end docker_container 'shipyard' do # Other attributes action :run end
docker_container action :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
docker_container action :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
docker_container action :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
docker_container action :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
docker_container action :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
docker_container action :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'] |
docker_image action :build and :build_if_missing
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 |
no_cache | Do not use the cache when building the image | TrueClass, FalseClass | false |
path (DEPRECATED) | Local path to files | String | nil |
rm | Remove intermediate containers after a successful build | TrueClass, FalseClass | false |
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_if_missing end
Build image from remote repository:
docker_image 'myImage' do source 'example.com/foo/myImage' tag 'myTag' action :build_if_missing end
Conditionally rebuild image if changes upstream:
git "#{Chef::Config[:file_cache_path]}/docker-testcontainerd" do repository 'git@github.com:bflad/docker-testcontainerd.git' notifies :build, 'docker_image[bflad/testcontainerd]', :immediately end docker_image 'bflad/testcontainerd' do action :pull_if_missing end
docker_image action :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
docker_image action :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
docker_image action :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
docker_image action :pull and :pull_if_missing
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 every Chef run:
docker_image 'busybox'
Pull latest image only if missing:
docker_image 'busybox' do action :pull_if_missing end
Pull tagged image:
docker_image 'bflad/test' do tag 'not-latest' end
docker_image action :push
Push image (after logging in with docker_registry
):
docker_image 'bflad/test' do action :push end
docker_image action :remove
Remove image:
docker_image 'busybox' do action :remove end
docker_image action :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
docker_image action :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'] |
docker_registry action :login
These attributes are associated with this LWRP action.
Attribute | Description | Type | Default |
---|---|---|---|
Registry email | String | nil | |
password | Registry password | String | nil |
username | Registry username | String | nil |
Log into or register with public registry:
docker_registry 'https://index.docker.io/v1/' do
email 'publicme@example.com'
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
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
- Brian Flad (bflad417@gmail.com)
License
Please see licensing information in: [LICENSE](LICENSE)
Dependent cookbooks
apt >= 0.0.0 |
git >= 0.0.0 |
golang >= 0.0.0 |
homebrew >= 0.0.0 |
lxc >= 1.1.6 |
modules >= 0.0.0 |
sysctl >= 0.0.0 |
yum-epel >= 0.0.0 |