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.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.3.16
-
2.3.15
-
2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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', '= 1.0.14', :supermarket
knife supermarket install docker
knife supermarket download docker
Docker Cookbook
The Docker Cookbook is a library cookbook that provides resources
(LWRPs) for use in recipes.
Scope
This cookbook is concerned with the Docker
container engine as distributed by Docker, Inc. It does not address
Docker ecosystem tooling or prerequisite technology such as cgroups or
aufs.
Requirements
- Chef 12 or higher
- Ruby 1.9 or higher (preferably, the Chef full-stack installer)
- Network accessible web server hosting the docker binary.
- SELinux permissive/disabled if CentOS Docker Issue #15498
Platform Support
The following platforms have been tested with Test Kitchen: You may be
able to get it working on other platforms, with appropriate
configuration of cgroups and storage back ends.
|--------------+-------+-------+-------|
| | 1.6.2 | 1.7.1 | 1.8.1 |
|--------------+-------+-------+-------|
| debian-8 | X | X | x |
|--------------+-------+-------+-------|
| centos-7 | X | X | x |
|--------------+-------+-------+-------|
| fedora-21 | X | X | x |
|--------------+-------+-------+-------|
| ubuntu-14.04 | X | | |
|--------------+-------+-------+-------|
| ubuntu-15.04 | X | X | x |
|--------------+-------+-------+-------|
Cookbook Dependencies
- none!
Usage
- Add
depends 'docker', '~> 1.0'
to your cookbook's metadata.rb - Use resources shipped in cookbook in a recipe, the same way you'd use core Chef resources (file, template, directory, package, etc).
docker_service 'default' do action [:create, :start] end docker_image 'busybox' do action :pull end docker_container 'an echo server' do repo 'busybox' port '1234:1234' command "nc -ll -p 1234 -e /bin/cat" end
Test Cookbooks as Examples
The cookbooks ran under test-kitchen make excellent usage examples.
The test recipes are found at:
ruby
test/cookbooks/docker_test/
test/cookbooks/docker_service_test/
Cgroups, Execution and Storage drivers
Beginning in chef-docker 1.0, support for LXC execution driver has
been removed in favor of native. Cgroups and storage drivers are now
loosely coupled dependencies and should be configured using other
cookbooks if needed.
Storage drivers can be selected with the storage_driver
property on
the docker_service
resource like this:
docker_service 'default' do storage_driver 'overlay' end
Configuration of the backing storage driver, including kernel module
loading, is out of scope for this cookbook.
Resources Overview
-
docker_service
: docker daemon installation and configuration -
docker_image
: image/repository operations -
docker_tag
: image tagging operations -
docker_container
: container operations -
docker_registry
: registry operations
Getting Started
Here's a quick example of pulling the latest image and running a
container with exposed ports.
# Pull latest image docker_image 'nginx' do tag 'latest' action :pull notifies :redeploy, 'docker_container[my_nginx]' end # Run container exposing ports docker_container 'my_nginx' do repo 'nginx' tag 'latest' port '80:80' hostname 'www' domain_name 'computers.biz' env 'FOO=bar' binds [ '/some/local/files/:/etc/nginx/conf.d' ] end
You might run a private registry
# Login to private registry docker_registry 'https://registry.computers.biz/' do username 'shipper' password 'iloveshipping' email 'shipper@computers.biz' end # Pull tagged image docker_image 'registry.computers.biz:443/my_project/my_container' do tag 'latest' action :pull end # Run container docker_container 'crowsnest' do repo 'registry.computers.biz:443/my_project/my_container' tag 'latest' action :run end
See full documentation for each resource and action below for more
information.
Resources Details
The docker_service
, docker_image
, docker_container
,
and docker_registry
resources are documented in full below.
docker_service
The docker_service
manages a Docker daemon.
The :create
action manages software installation.
The :start
action manages the running docker service on the machine.
The service management strategy for the host platform is dynamically
chosen based on platform, but can be overridden. See the "providers"
section below for more information.
Example
docker_service 'tls_test:2376' do host ["tcp://#{node['ipaddress']}:2376", 'unix:///var/run/docker.sock'] tlscacert '/path/to/ca.pem' tlscert '/path/to/server.pem' tlskey '/path/to/serverkey.pem' tlsverify true provider Chef::Provider::DockerService::Systemd action [:create, :start] end
WARNING - As of the 1.0 version of this cookbook, docker_service
is a singleton resource. This means that if you create multiple
docker_service
resources on the same machine, you will only
create one actual service and things may not work as expected.
Properties
The docker_service
resource property list mostly corresponds to
the options found in the
Docker Command Line Reference
-
source
- URL to the pre-compiled Docker binary used for installation. Defaults to a calculated URL based on kernel version, Docker version, and platform arch. By default, this will try to get to "http://get.docker.io/builds/". -
version
- Docker version to install -
checksum
- sha256 checksum of Docker binary -
instance
- Identity fordocker_service
resource. Defaults to name. Mostly unimportant for the 1.0 version because of its singleton status. | String | nil -
api_cors_header
- Set CORS headers in the remote API -
bridge
- Attach containers to a network bridge -
bip
- Specify network bridge IP -
debug
- Enable debug mode -
daemon
- Enable daemon mode -
dns
- DNS server to use -
dns_search
- DNS search domains to use -
exec_driver
- Exec driver to use -
fixed_cidr
- IPv4 subnet for fixed IPs -
fixed_cidr_v6
- IPv6 subnet for fixed IPs -
group
- Posix group for the unix socket -
graph
- Root of the Docker runtime - Effectively, the "data directory" -
host
- Daemon socket(s) to connect to -tcp://host:port
,unix:///path/to/socket
,fd://*
orfd://socketfd
-
icc
- Enable inter-container communication -
ip
- Default IP when binding container ports -
ip_forward
- Enable ip forwarding -
ipv4_forward
- Enable net.ipv4.ip_forward -
ipv6_forward
- Enable net.ipv6.ip_forward -
ip_masq
- Enable IP masquerading -
iptables
- Enable addition of iptables rules -
ipv6
- Enable IPv6 networking -
log_level
- Set the logging level -
label
- Set key=value labels to the daemon -
log_driver
- Container's logging driver (json-file/none) -
mtu
- Container's logging driver (json-file/none) -
pidfile
- Path to use for daemon PID file -
registry_mirror
- Preferred Docker registry mirror -
storage_driver
- Storage driver to use -
selinux_enabled
- Enable selinux support -
storage_opt
- Set storage driver options -
tls
- Use TLS; implied by --tlsverify -
tlscacert
- Trust certs signed only by this CA -
tlscert
- Path to TLS certificate file -
tlskey
- Path to TLS key file -
tlsverify
- Use TLS and verify the remote -
default_ulimit
- Set default ulimit settings for containers -
http_proxy
- ENV variable set before for Docker daemon starts -
https_proxy
- ENV variable set before for Docker daemon starts -
no_proxy
- ENV variable set before for Docker daemon starts -
tmpdir
- ENV variable set before for Docker daemon starts -
logfile
- Location of Docker daemon log file
Actions
-
:create
- Lays the Docker bits out on disk -
:delete
- Removes the Docker bits from the disk -
:start
- Makes sure the service provider is set up properly and start it -
:stop
- Stops the service -
:restart
- Restarts the service
Providers
Chef::Provider::DockerService::Execute
- The simplest provider. Just
starts a process. Fire and forget.Chef::Provider::DockerService::Sysvinit
- Uses a SystemV init script
to manage the service state.Chef::Provider::DockerService::Upstart
- Uses an Upstart script to
manage the service state.Chef::Provider::DockerService::Systemd
- Uses an Systemd unit file to
manage the service state. NOTE: This does NOT enable systemd socket
activation.
docker_image
The docker_image
is responsible for managing Docker image pulls,
builds, and deletions. It speaks directly to the
Docker remote API.
Examples
default action, default properties
ruby
docker_image 'hello-world'
non-default name attribute
ruby
docker_image "Tom's container" do
repo 'tduffield/testcontainerd'
action :pull
end
pull every time
ruby
docker_image 'busybox' do
action :pull
end
specify a tag
ruby
docker_image 'alpine' do
tag '3.1'
end
specify read/write timeouts
ruby
docker_image 'alpine' do
read_timeout 60
write_timeout 60
end
docker_image 'vbatts/slackware' do action :remove end
save
ruby
docker_image 'save hello-world' do
repo 'hello-world'
destination '/tmp/hello-world.tar'
not_if { ::File.exist? '/tmp/hello-world.tar' }
action :save
end
build from a Dockerfile on every chef-client run
ruby
docker_image 'image_1' do
tag 'v0.1.0'
source '/src/myproject/container1/Dockerfile'
action :build
end
build from a directory, only if image is missing
ruby
docker_image 'image_2' do
tag 'v0.1.0'
source '/src/myproject/container2'
action :build_if_missing
end
build from a tarball
NOTE: this is not an "export" tarball generated from an an image save.
The contents should be a Dockerfile, and anything it references to
COPY or ADD
docker_image 'image_3' do tag 'v0.1.0' source '/tmp/image_3.tar' action :build end
docker_image 'hello-again' do tag 'v0.1.0' source '/tmp/hello-world.tar' action :import end
push
ruby
docker_image 'my.computers.biz:5043/someara/hello-again' do
action :push
end
Properties
The docker_image
resource properties mostly corresponds to the
Docker Remote API
as driven by the
Swipley docker-api Ruby gem
A docker_image
's full identifier is a string in the form
"<repo>:<tag>". There is some nuance around the naming when the public
registry vs a private one.
-
repo
- akaimage_name
- The first half of a Docker image's identity. This is a string in the form:registry:port/owner/image_name
. If theregistry:port
portion is left off, Docker will implicitly use the Docker public registry. "Official Images" omit the owner part. This means a repo id can look as short asbusybox
,alpine
, orcentos
, to refer to official images on the public registry, and as long asmy.computers.biz:5043:/what/ever
to refer to custom images on an private registry. Often you'll see something likesomeara/chef
to refer to private images on the public registry. - Defaults to resource name. -
tag
- The second half of a Docker image's identity. - Defaults tolatest
-
source
- Path to input for the:import
,:build
and:build_if_missing
actions. For building, this can be a Dockerfile, a tarball containing a Dockerfile in its root, or a directory containing a Dockerfile. For import, this should be a tarball containing Docker formatted image, as generated with:save
. -
destination
- Path for output from the:save
action. -
force
- A force boolean used in various actions - Defaults to false -
nocache
- Used in:build
operations. - Defaults to false -
noprune
- Used in:remove
operations - Defaults to false -
rm
- Remove intermediate containers after a successful build (default behavior) - Defaults totrue
-
read_timeout
- May need to increase for long image builds/pulls -
write_timeout
- May need to increase for long image builds/pulls
Actions
The following actions are available for a docker_image
resource.
Defaults to pull_if_missing
-
:pull
- Pulls an image from the registry -
:pull_if_missing
- Pulls an image from the registry, only if it missing -
:build
- Builds an image from a Dockerfile, directory, or tarball -
:build_if_missing
- Same build, but only if it is missing -
:save
- Exports an image to a tarball atdestination
-
:import
- Imports an image from a tarball atdestination
-
:remove
- Removes (untags) an image -
:push
- Pushes an image to the registry
docker_tag
Docker tags work very much like hard links in a Unix filesystem. They
are just references to an existing image. Therefore, the docker_tag
resource has taken inspiration from the Chef link
resource.
Examples
docker_tag 'private repo tag for hello-again:1.0.1' do target_repo 'hello-again' target_tag 'v0.1.0' to_repo 'localhost:5043/someara/hello-again' to_tag 'latest' action :tag end
Properties
-
target_repo
- The repo half of the source image identifier. -
target_tag
- The tag half of the source image identifier. -
to_repo
- The repo half of the new image identifier -
to_tag
- The tag half of the new image identifier
Actions
-
:tag
- Tags the image
docker_container
The docker_container
is responsible for managing Docker container
actions. It speaks directly to the Docker remote API.
Containers are process oriented, and move through an event cycle.
Thanks to Glider Labs for this excellent diagram.
Examples
Create a container without starting it.
docker_container 'hello-world' do command '/hello' action :create end
This command will exit succesfully. This will happen on every
chef-client run.
docker_container 'busybox_ls' do repo 'busybox' command 'ls -la /' action :run end
The :run_if_missing action will only run once. It is the default action.
docker_container 'alpine_ls' do repo 'alpine' tag '3.1' command 'ls -la /' action :run_if_missing end
Set environment variables in a container
docker_container 'env' do repo 'debian' env ['PATH=/usr/bin', 'FOO=bar'] command 'env' action :run_if_missing end
This process remains running between chef-client runs, :run will do nothing on subsequent converges.
docker_container 'an_echo_server' do repo 'alpine' tag '3.1' command 'nc -ll -p 7 -e /bin/cat' port '7:7' action :run end
Let docker pick the host port
docker_container 'another_echo_server' do repo 'alpine' tag '3.1' command 'nc -ll -p 7 -e /bin/cat' port '7' action :run end
Specify the udp protocol
docker_container 'an_udp_echo_server' do repo 'alpine' tag '3.1' command 'nc -ul -p 7 -e /bin/cat' port '5007:7/udp' action :run end
Kill a container
docker_container 'bill' do action :kill end
Stop a container
docker_container 'hammer_time' do action :stop end
Pause a container
docker_container 'red_light' do action :pause end
Unpause a container
docker_container 'green_light' do action :unpause end
Restart a container
docker_container 'restarter' do action :restart end
Delete a container
docker_container 'deleteme' do remove_volumes true action :delete end
Redeploy a container
docker_container 'redeployer' do repo 'alpine' tag '3.1' command 'nc -ll -p 7777 -e /bin/cat' port '7' action :run end execute 'redeploy redeployer' do notifies :redeploy, 'docker_container[redeployer]', :immediately action :run end
Bind mount local directories
docker_container 'bind_mounter' do repo 'busybox' command 'ls -la /bits /more-bits' binds ['/hostbits:/bits', '/more-hostbits:/more-bits'] action :run_if_missing end
Mount volumes from another container
docker_container 'chef_container' do command 'true' volumes '/opt/chef' action :create end docker_container 'ohai_debian' do command '/opt/chef/embedded/bin/ohai platform' repo 'debian' volumes_from 'chef_container' end
Set a container's entrypoint
docker_container 'ohai_again_debian' do repo 'debian' volumes_from 'chef_container' entrypoint '/opt/chef/embedded/bin/ohai' command 'platform' action :run_if_missing end
Automatically remove a container after it exits
docker_container 'sean_was_here' do command "touch /opt/chef/sean_was_here-#{Time.new.strftime('%Y%m%d%H%M')}" repo 'debian' volumes_from 'chef_container' autoremove true action :run end
Grant NET_ADMIN rights to a container
docker_container 'cap_add_net_admin' do repo 'debian' command 'bash -c "ip addr add 10.9.8.7/24 brd + dev eth0 label eth0:0 ; ip addr list"' cap_add 'NET_ADMIN' action :run_if_missing end
Revoke MKNOD rights to a container
ruby
docker_container 'cap_drop_mknod' do
repo 'debian'
command 'bash -c "mknod -m 444 /dev/urandom2 c 1 9 ; ls -la /dev/urandom2"'
cap_drop 'MKNOD'
action :run_if_missing
end
Set a container's hostname and domainname
docker_container 'fqdn' do repo 'debian' command 'hostname -f' host_name 'computers' domain_name 'biz' action :run_if_missing end
Set a container's DNS resolution
docker_container 'dns' do repo 'debian' command 'cat /etc/resolv.conf' host_name 'computers' dns ['4.3.2.1', '1.2.3.4'] dns_search ['computers.biz', 'chef.io'] action :run_if_missing end
Add extra hosts to a container's /etc/hosts
docker_container 'extra_hosts' do repo 'debian' command 'cat /etc/hosts' extra_hosts ['east:4.3.2.1', 'west:1.2.3.4'] action :run_if_missing end
Manage container's restart_policy
docker_container 'try_try_again' do repo 'alpine' tag '3.1' command 'grep asdasdasd /etc/passwd' restart_policy 'on-failure' restart_maximum_retry_count 2 action :run_if_missing end docker_container 'reboot_survivor' do repo 'alpine' tag '3.1' command 'nc -ll -p 123 -e /bin/cat' port '123' restart_policy 'always' action :run_if_missing end
Manage container links
docker_container 'link_source' do repo 'alpine' tag '3.1' env ['FOO=bar', 'BIZ=baz'] command 'nc -ll -p 321 -e /bin/cat' port '321' action :run_if_missing end docker_container 'link_target_1' do repo 'alpine' tag '3.1' env ['ASD=asd'] command 'ping -c 1 hello' links ['link_source:hello'] action :run_if_missing end docker_container 'link_target_2' do repo 'alpine' tag '3.1' command 'env' links ['link_source:hello'] action :run_if_missing end execute 'redeploy_link_source' do command 'touch /marker_container_redeploy_link_source' creates '/marker_container_redeploy_link_source' notifies :redeploy, 'docker_container[link_source]', :immediately notifies :redeploy, 'docker_container[link_target_1]', :immediately notifies :redeploy, 'docker_container[link_target_2]', :immediately action :run end
Mutate a container between chef-client runs
docker_tag 'mutator_from_busybox' do target_repo 'busybox' target_tag 'latest' to_repo 'someara/mutator' target_tag 'latest' end docker_container 'mutator' do repo 'someara/mutator' tag 'latest' command "sh -c 'touch /mutator-`date +\"%Y-%m-%d_%H-%M-%S\"`'" outfile '/mutator.tar' force true action :run_if_missing end execute 'commit mutator' do command 'true' notifies :commit, 'docker_container[mutator]', :immediately notifies :export, 'docker_container[mutator]', :immediately notifies :redeploy, 'docker_container[mutator]', :immediately action :run end
Specify read/write timeouts
docker_container 'api_timeouts' do repo 'alpine' read_timeout 60 write_timeout 60 end
Properties
Most docker_container
properties are the snake_case
version of the
CamelCase
keys found in the
Docker Remote Api
-
container_name
- The name of the container. Defaults to the name of thedocker_container
resource. -
repo
- akaimage_name
. The first half of a the complete identifier for a Docker Image. -
tag
- The second half of a Docker image's identity. - Defaults tolatest
. -
command
- The command to run when starting the container. -
autoremove
- Boolean - Automatically delete a container when it's command exits. Defaults tofalse
. -
binds
- An array of:
separated paths to bind mount from the host into the container in the form['/host-bits:/container-bits', '/more-host-bits:/more-container-bits']
. Defaults tonil
. -
cap_add
- An array Linux Capabilities (man 7 capabilities
) to add to grant the container beyond what it normally gets. -
cap_drop
- An array Linux Capabilities (man 7 capabilities
) to revoke that the container normally has. -
cpu_shares
- An integer value containing the CPU Shares for the container. -
devices
- A Hash of devices to add to the container. -
dns
- An array of DNS servers the container will use for name resolution. -
dns_search
- An array of domains the container will search for name resolution. -
domain_name
- Set's the container's dnsdomainname as returned by thednsdomainname
command. -
entry_point
- Set the entry point for the container as a string or an array of strings. -
env
- Set environment variables in the container in the form['FOO=bar', 'BIZ=baz']
-
extra_hosts
- An array of hosts to add to the container's/etc/hosts
in the form['host_a:10.9.8.7', 'host_b:10.9.8.6']
-
force
- A boolean to use in container operations that support aforce
option. Defaults tofalse
-
host_name
- The hostname for the container. -
links
- An array of source container/alias pairs to link the container to in the form[container_a:www', container_b:db']
-
mac_address
- The mac address for the container to use. -
memory
- Memory limit in bytes. -
memory_swap
- Total memory limit (memory + swap); set-1
to disable swap. You must use this with memory and make the swap value larger than memory. -
network_disabled
- Boolean to disable networking. Defaults tofalse
. -
network_mode
- Sets the networking mode for the container. -
open_stdin
- Boolean value, opens stdin. Defaults tofalse
. -
outfile
- The path to write the file when using:export
action. -
port
- The port configuration to use in the container. Matches the syntax used by thedocker
CLI tool. -
privileged
- Boolean to start the container in privileged more. Defaults tofalse
-
publish_all_ports
- Allocates a random host port for all of a container’s exposed ports. -
remove_volumes
- A boolean to clean up "dangling" volumes when removing the last container with a reference to it. Default tofalse
to match the Docker CLI behavior. -
restart_policy
- One ofno
,on-failure
, oralways
. Usealways
if you want a service container to survive a Dockerhost reboot. Defaults tono
. -
restart_maximum_retry_count
- Maximum number of restarts to try whenrestart_policy
ison-failure
. Defaults to an ever increasing delay (double the previous delay, starting at 100mS), to prevent flooding the server. -
security_opts
- A list of string values to customize labels for MLS systems, such as SELinux. -
signal
- The signal to send when using the:kill
action. Defaults toSIGKILL
. -
tty
- Boolean value to allocate a pseudo-TTY. Defaults tofalse
. -
user
- A string value specifying the user inside the container. -
volumes
- An Array of paths inside the container to expose. Does the same thing as theVOLUME
directive in a Dockerfile, but works on container creation. -
volumes_from
- A list of volumes to inherit from another container. Specified in the form<container name>[:<ro|rw>]
-
working_dir
- A string specifying the working directory for commands to run in. -
read_timeout
- May need to increase for commits or exports that are slow -
write_timeout
- May need to increase for commits or exports that are slow
Actions
-
:create
- Creates the container but does not start it. Useful for Volume containers. -
:start
- Starts the container. Useful for containers that run jobs.. command that exit. -
:run
- Both:create
and:start
the container in one action. -
:run_if_missing
- The default action. Runs a container only once. -
:stop
- Stops the container. -
:restart
- Stops the starts the container. -
:kill
- Send a signal to the container process. Defaults toSIGKILL
. -
:pause
- Pauses the container. -
:unpause
- Unpauses the container. -
:delete
- Deletes the container. -
:redeploy
- Deletes and runs the container.
docker_registry
The docker_registry
resource is responsible for managing the
connection auth information to a Docker registry.
docker_registry action :login
Log into or register with public registry:
docker_registry 'https://index.docker.io/v1/' do username 'publicme' password 'hope_this_is_in_encrypted_databag' email 'publicme@computers.biz' end
Log into private registry with optional port:
docker_registry 'my local registry' do serveraddress 'https://registry.computers.biz:8443/' username 'privateme' password 'still_hope_this_is_in_encrypted_databag' email privateme@computers.biz' end
Testing and Development
- 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
- Tom Duffield (http://tomduffield.com)
- Brian Flad (bflad417@gmail.com)
- Fletcher Nichol (fnichol@nichol.ca)
- Sean OMeara (sean@chef.io)
License
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Dependent cookbooks
This cookbook has no specified dependencies.
Contingent cookbooks
v1.0.14
- Adding api read and write timeouts
v1.0.13
- Fixing docker_service CLI argument generation for log-driver mtu and pidfile
v1.0.12
- Fixing platform_family string (redhat -> rhel) in docker_service sysvinit provider
v1.0.11
- Renaming retries to api_retries to not conflict with Chef::Resource
v1.0.10
- Accepting userland-proxy flag
- Fix bug in parsed_storage_driver method
- Correcting usage of ip_forwarding flag
- Let Docker pick --log-level instead of defaulting to :info
v1.0.9
- Fixing Upstart respawn limit
v1.0.8
- #382 - Fixing docker_service to accept an array for storage_opt
v1.0.7
- #381 - Removing prepended whitespace in DOCKER_OPTS
v1.0.6
- #369 - Fixing up HostConfig.NetworkMode to work as expected
v1.0.5
- #241 - Only updating docker_image resource on :pull if new bits were pulled on tag (useful for latest)
- Changing docker_image default action to :pull
v1.0.4
- #368 - Fixing port property to be kind_of [String, Array]
- Adding missing detach property. Defaulting to false.
v1.0.3
- #366 - Using docker_kernel instead of docker_arch in parsed_checksum
v1.0.2
- #365 - Fix logic for parsing an array of hosts
- #363 - Allow an array for port property
v1.0.1
- Switching docker_service default TLS setting to false to it works out of the box
v1.0.0
- vendoring the docker-api rubygem
- docker_image and docker_container resources now use speak to the Docker Remote API instead of shelling out
- docker_containers must now have unique names
- "volumes" property now acts like the VOLUMES directive in a Dockerfile
- added "binds" property for local mounting
- standardizing on "repo" and "tag" as components of an image identifier
v0.43.0 (2015-07-28)
- Updating README to reflect docker_image and docker_tag reality
- Implementing rm, noprune, nocache and force on docker_image
v0.42.0 (2015-07-28)
- removing docker_image :load and :tag action
- adding docker_tag resource
- renaming docker_tag image_name property to :repo; creating alias
- implementing docker_image :push action
v0.41.0 (2015-07-26)
- vendoring docker-api rubygem
- beginning work to convert docker_image to use native API instead of shelling out
- changing docker_image default action to :pull_if_missing
- removing some deprecated interfaces
v0.40.3 (2015-07-14)
- remove --no-trunc from docker container status in sysvinit script
- #334 - docker_container tag property (issue 320)
- #331 - docker_container ulimit property
- #328 - Upstart job respawn status detection
- #326 - Upstart job restart behavior fix sysvinit script examples
- #236 - README#324 - Reference DOCKER_OPTS Amazon Linux#325
v0.40.2 (2015-07-14)
- Support for older Chef versions
v0.40.1 (2015-07-08)
- Changing host property to kind_of Array
v0.40.0 (2015-06-29)
Important changes with this release:
- MAJOR INTERFACE CHANGE
- Recipes replaced with docker_service resource*
- Removing a ton of dependencies
- Storage backends, kernel module loading, etc should now be handled externally
- Updating for Docker 1.6.2
- Preferring binary install method to OS packages
IMPORTANT
* attributes/ will be removed in the next release.
* most are currently non-functional
* All options will be driven through resource properties
v0.37.0
Please note some important changes with this release:
- The sysconfig DOCKER_OPTS improvement in #250 can potentially change the behavior of that environment variable as it now allows shell interpolation of any embedded variables. This should not affect most environments. If your DOCKER_OPTS does contains any expected
$
, please escape via\$
for previous behavior or be sure it will behave as expected before upgrading. - The daemon restart option (which is deprecated) has been defaulted to
nil
instead offalse
whennode['docker']['container_init_type']
is set to prevent issues with container restart policies. If you're dependent on the daemon option, please be sure to update yournode['docker']['restart']
appropriately. This release also defaults systemd docker host to
fd://
to match upstream, enabling socket activation properly. Adjustnode['docker']['host']
if necessary.Bugfix: #239: Upstart: install inotify tools only once (avoid CHEF-3694 warning) (thanks jperville)
Bugfix: #240: Fixed dead service containers not being restarted on docker_container :run (thanks jperville)
Bugfix: #244: Made docker_container action :remove remove the actual upstart service file (thanks jperville)
Bugfix: #246: Lengthen shell_out timeout as workaround for slow docker_container action stop (thanks jperville)
Bugfix: #258: Fix checking docker container status on debian (thanks fxposter)
Bugfix: #260: Fix accidental port changing when using systemd templates (thanks fxposter)
Bugfix: #266: Get tests working on master (thanks tduffield)
Bugfix: #267: Replace outdated testcontainerd (thanks tduffield)
Bugfix: #269: Fix tests on Travis by following Rubocop style guidelines (container LWRP) (thanks fxposter)
Bugfix: #280 / #281: Fix port handling when omitted in container LWRP (thanks databus23)
Bugfix: #284 / #285: runit finish script to stop a container (thanks xmik)
Bugfix: [#288][]: Fix docker.socket unit for RHEL7 (thanks databus23)
Bugfix: #292: readme formatting fix (thanks wormzer)
Improvement: #208: Add CentOS/RHEL 7 support (thanks dermusikman and intoximeters)
Improvement: #232: Added support for insecure-registry docker daemon option (thanks jperville)
Improvement: #233 / #234: Added support for registry-mirror docker daemon option (thanks jperville and tarnfeld)
Improvement: #237: Deprecate the restart daemon option (thanks jperville)
Improvement: #238: Added docker_container restart attribute (thanks jperville)
Improvement: #242: Added docker_container action :create (thanks jperville)
Improvement: #245: Add a Gitter chat badge to README.md (thanks tduffield)
Improvement: #250: Use double-quotes for DOCKER_OPTS (thanks rchekaluk)
Improvement: #259: Use registry on image inspection (thanks fxposter)
Improvement: #263: Add additional_host attribute to container resource (thanks fxposter)
Improvement: #264 / #265: Access keyserver.ubuntu.com on port 80 (thanks sauraus)
Improvement: #268: Updated the /etc/init/docker.conf template (thanks jperville)
Improvement: #276: Added support for docker options device and cap-add (thanks hvolkmer)
Improvement: #279: Allow docker_container memory to have String value (eg. memory='1G') (thanks jperville)
Improvement: #287: redhat 7 does not need the epel repository (thanks databus23)
Improvement: #289: Update systemd service/socket files (from upstream) (thanks databus23)
Improvement: #296: Default systemd to fd:// as well as use upstream MountFlags=slave and LimitCORE=infinity
Improvement: #297: Update docker daemon SysV init scripts with upstream improvements
Improvement: #298: Further deprecate daemon restart flag by default, which interferes with restart policies
0.36.0
- Bugfix: #181: Fixed remove_link action (thanks jperville).
- Bugfix: #185: Fix for non idempotent run action on docker_container (thanks bplunkert).
- Bugfix: #188: Applied temporary workaround to address the libcgmanager error to users running LXC on Ubuntu 14.04.
- Bugfix: #196: Address Helpers module naming conflict (thanks sethrosenblum).
- Bugfix: #200: Fix how service actions are handled by docker_container resource (thanks brianhartsock).
- Bugfix: #202: Correctly check for the kernel.release version on Debian (thanks Tritlo, paweloczadly).
- Bugfix: #203: Fix pull notifications for tagged images (thanks hobofan).
- Bugfix: #205: Fix current_resource.name assignments in docker_container provider (thanks jperville).
- Bugfix: #206: Fixes to container name detection (thanks jperville).
- Enhancement: #217: Explicitly set key and keyserver for docker apt repository (thanks sethrosenblum).
- Improvement: Pull in init script changes from upstream for sysv and systemd.
- Bugfix: #219: Explicitly set Upstart provider for Ubuntu 14.04 and 14.10 (thanks methodx).
- Improvement: #220: Create graph directory if it is specified (thanks jontg).
- Bugfix: #224: Fix runit container template to properly use exec (thanks waisbrot).
- Bugfix: Appropriately check for LXC when using the binary recipe on Fedora.
- Bugfix: Implement workaround for docker/docker#2702 on Ubuntu 14.10.
- Enhancement: #221: Added NO_PROXY support (thanks jperville).
- Various Test Suite Modifications
- Enhancement: #192: Allow image tags in serverspec matching (thanks bplunkert).
- Bugfix: #223: Convert a few occurrences of old 'should' rspec syntax to 'expect' (thanks jperville).
- Disable a few platforms that are experiencing bugs unrelated to core functionality.
- Address ChefSpec 4.1 deprecation warnings.
- Update Berksfile to reference supermarket.getchef.com instead of api.berkshelf.com
0.35.2
- Bugfix: #171: Default Ubuntu 14.04 to Docker PPA
- Bugfix: #175: Do not set --selinux-enabled in opts unless explicitly defined for older versions
- Bugfix: #176: Use docker host attribute in docker_container Upstart inotifywait
0.35.1
- Bugfix: #172: Generate no cidfile by default, even when deploying as service
- Bugfix: #173: Updated docker upstart script (should fix service docker restart)
0.35.0
After a long personal hiatus (sorry!), this is the last minor release before 1.0 of the cookbook. If you can handle the Docker port number change and don't use anything deprecated, upgrading to 1.0.X from 0.35.X of the cookbook should be very easy.
This release has a bunch of changes and hasn't been fully tested yet. Wanted to get it out there for broad testing. Please use caution!
Major kudos to @tduffield for the #147 PR, which includes:
* Binary Installation
* Added missing dependency resolution for using the binary.
* Dependency Checks
* Added docker::dep_check
that will take an action if certain dependencies are not met.
* node[docker][alert_on_error_action] = :fatal
will kill the chef run and print the error message.
* node[docker][alert_on_error_action] = :warn
will print the error message but continue with the chef run. There is no guarantee that it will succeed though.
* KitchenCI
* Copied MiniTests to ServerSpec Tests
* Added new platforms (Debian 7.4)
* Changed provisioner from chef-solo to chef-zero
* Removed Ubuntu 12.10 because it is not supported by Docker and the Kernel is bad and fails all the tests.
* Removed tests for the source recipe. The dotcloud/docker repo actually doesn’t build any Go deliverables.
* I think that the source recipe needs to be completely refactored.
Other awesome work merged:
- #142: Bugfix: Redeploy breaks when a link is present
- #139/#153/#154/#156/#157: Bugfix: container/image ID given as nil, fixes deprecated -notrunc
- #164: Bugfix: Removing a container should also remove its cidfile
- #166: Bugfix: Fix docker_inspect_id for Docker 1.0+
- #158/#160/#165: Bugfix: Fix NameError when displaying error messages for timed-out commands
- #169: Bugfix: Specify Upstart as service provider for cgroup on Ubuntu 14.04 (workaround for CHEF-5276, fixed in Chef 11.14)
- #137/#138: Enhancement: Experimental Ubuntu 14.04 LTS support
- #144: Enhancement: Experimental Amazon linux support
- #150/#152: Enhancement: Add net attribute, deprecate networking
- #168: Enhancement: Allow override of package name
- #161: Enhancement: Add minitest case for SysV service
- #149: Enhancement: Add --selinux-enabled daemon flag
- Enhancement: container LWRP remove_link and remove_volume actions
- Enhancement: Add storage-opt daemon flag
- Enhancement: Add Docker 0.11.0, 0.11.1, 0.12.0, 1.0.0, 1.0.1 binary checksums
0.34.2
-
#141: Bugfix/Enhancement: Fix and enhance docker_image pull/push behavior with Docker 0.10
- Removes deprecated --registry and --tag CLI args from docker_image pull
- Adds support for registry attribute usage in docker_image pull and push
- Adds support for tag attribute usage in docker_image push
0.34.1
- #134: Bugfix: Fix docker_registry login handling, fixes #114
0.34.0
Attributes now available for all docker daemon flags as well as system IP forwarding.
- REMOVED: container_dns* attributes (use replacement dns* attributes on daemon for all containers or docker_container dns* attributes instead)
- DEPRECATED: bind_* attributes to match docker terminology (use host attribute instead)
- Bugfix: #132: Do Not Explicitly Set storage_driver Attribute
- Bugfix: #133: Remove explicit false defaults in resources
- Bugfix: #114: Error executing action login on resource docker_registry
- Enhancement: #115: Add IP forwarding attributes
- Enhancement: #116: Docker 0.10.0: Add --no-prune to docker rmi
- Enhancement: #117: Docker 0.10.0: Add --output flag to docker save (as well as tag support)
- Enhancement: #118: Docker 0.10.0: Add --input flag to docker load
- Enhancement: #119: Docker 0.10.0: Add support for --env-file to load environment variables from files
- Enhancement: #120: Docker 0.10.0: Deprecate docker insert
- Enhancement: #123: Add docker kill --signal
- Enhancement: #124: Add all docker daemon options as attributes
- Enhancement: #125: Use dns* attributes to set docker daemon options, not defaults per-container
- Enhancement: #128: Add checksum attribute for binary downloads
- Enhancement: #126: Set long option names for specified docker daemon options
- Enhancement: #127: Use a helper function to specify single line docker daemon options
0.33.1
- Bugfix: #112: Defines runner methods for ChefSpec matchers
- Bugfix: #113: [D-15] Fedora 19 installs Docker 0.8.1, does not have the -G or -e flag
0.33.0
This release deprecates AUFS/device-mapper handling from chef-docker, but provides backwards compatibility by still including the default recipe of the new cookbooks. Please update your dependencies, Github watching/issues, and recipes to reflect the two new community cookbooks:
* aufs: aufs on community site / chef-aufs on Github
* device-mapper: device-mapper on community site / chef-device-mapper on Github
- Bugfix: #109: Remove on lxc-net start from docker Upstart
- Enhancement: #88: Migrate AUFS logic to separate cookbook
- Enhancement: #90: Migrate device-mapper logic to separate cookbook
- Enhancement: #110: Add docker Upstart pre-start script and limits configuration
- Enhancement: #105: Add --label for docker run
- Enhancement: #106: Add --opt for docker run
- Enhancement: #107: Add --networking for docker run
- Enhancement: #108: Add --dns-search for docker run
- Enhancement: #104: Add TMPDIR
- Enhancement: #111: Add DOCKER_LOGFILE configuration
- Enhancement: container_dns* attributes to set --dns and --dns-search for all containers
0.32.2
- Bugfix: #101: Explicitly install lxc on Ubuntu (when lxc is exec_driver; continue to fully support LXC as a default installation path since its been since Docker 0.1)
- Bugfix: #103: Fix host argument (in docker run)
0.32.1
- Bugfix: #98: Ensure Ruby 1.8 syntax is supported
- Bugfix: Skip empty Array values in cli_args helper
0.32.0
If you're using CentOS/RHEL with EPEL, upcoming docker-io 0.9.0 package upgrade can be tracked at Bugzilla 1074880
This release includes Docker 0.9.0 changes and defaults, such as setting exec_driver to libcontainer ("native"), setting -rm on docker build, double dash arguments on the CLI, additional flags, etc.
- DEPRECATED: Rename storage_type attribute to storage_driver to match Docker terminology (storage_type will be removed in chef-docker 1.0)
- DEPRECATED: Rename virtualization_type attribute to exec_driver to match Docker terminology (virtualization_type will be removed in chef-docker 1.0)
- Bugfix: #80: Use double dashed arguments on CLI
- Bugfix: Surround String values on CLI with quotes
- Enhancement: #77: Improved docker ps handling
- Enhancement: #78: Docker 0.9.0: Make --rm the default for docker build
- Enhancement: #81: Docker 0.9.0: Add a -G option to specify the group which unix sockets belong
- Enhancement: #82: Docker 0.9.0: Add -f flag to docker rm to force removal of running containers
- Enhancement: Add -f flag for docker rmi to force removal of images
- Enhancement: #83: Docker 0.9.0: Add DOCKER_RAMDISK environment variable to make Docker work when the root is on a ramdisk
- Enhancement: #84: Docker 0.9.0: Add -e flag for execution driver
- Enhancement: #85: Docker 0.9.0: Default to libcontainer
- Enhancement: #86: Add Chefspec LWRP matchers
0.31.0
Lots of init love this release. Now supporting runit.
Please note change of storage_type attribute from devmapper to devicemapper (and associated recipe name change) to match docker's name for the driver.
Cookbook now automatically adds -s option to init configurations if storage_type is defined, which is it by default. If you were specifying -s in the options attribute, you no longer need to do so. In my quick testing, docker daemon doesn't seem to mind if -s is specified twice on startup, although you'll probably want to get rid of the extra specification.
I've also dropped the LANG= and LC_ALL= locale environment settings from the Upstart job configuration. Its not specified in the default docker job. Please open an issue in docker project and here if for some reason this is actually necessary.
- Bugfix: Match devicemapper storage_type attribute to match docker driver name (along with recipe name)
- Enhancement: #72: Add initial runit init_type
- Enhancement: #60: Automatically set docker -d -s from storage_type attribute
- Enhancement: Simplify default/sysconfig file into one template (docker.sysconfig.erb) and source into SysV/Upstart init configurations
- Enhancement: Add Debian docker daemon SysV init template
0.30.2
- Bugfix: #68: Fix CommandTimeout handling in LWRPs
- Bugfix: #67: Fix argument order to pull when tag specified
0.30.1
Public or private registry login should now correctly occur and login once per credentials change.
- Bugfix: #64: Correct CLI ordering of registry login
- Bugfix: #65: login command skipped in registry provider
- Enhancement: registry provider current resource attributes loaded from .dockercfg
0.30.0
Awesome work by @jcrobak to close out two issues (#49 and #52) with #62. Note change below in image build action.
- Bugfix: #52: return codes of docker commands not verified
- Bugfix: Add missing pull_if_missing action to image resource
- Enhancement: #56: Switch build action to build_if_missing, build action now builds each run (be careful with image growth!)
- Enhancement: #59: Add Mac OS X installation support
- Enhancement: #49: Add docker_cmd_timeout attribute and daemon verification
- Enhancement: #58: Add container redeploy action
- Enhancement: #63: Add group_members attribute and group recipe to manage docker group
0.29.0
- Enhancement: #57: Implement id checking when determining current_resource
- Added to both container and image LWRPs
- Enhancement: Set created and status attributes for current container resources (for handlers, wrappers, etc.)
- Enhancement: Set created and virtual_size attributes for image resource (for handlers, wrappers, etc.)
0.28.0
- Enhancement: #55: image LWRP pull action now attempts pull every run (use pull_if_missing action for old behavior)
0.27.1
- Bugfix: #51: container LWRP current_resource attribute matching should also depend on container_name
0.27.0
- Enhancement: #48: Accept FalseClass CLI arguments (also explicitly declare =true for TrueClass CLI arguments)
0.26.0
- Bugfix: Add SysV init script for binary installs
- Enhancement: Add storage_type and virtualization_type attributes
- Enhancement: Initial devmapper support for binary installs on CentOS/Ubuntu
- Enhancement: #47 Debian-specific container SysV init script
- Enhancement: #46 Add rm attribute for build action on image LWRP
- Enhancement: Add no_cache attribute for build action on image LWRP
0.25.1
- Bugfix: #44 Add missing run attribute for commit action on container LWRP
0.25.0
- DEPRECATED: image LWRP dockerfile, image_url, and path attributes (replaced with source attribute)
- Bugfix: Use docker_cmd for container LWRP remove and restart actions
- Enhancement: Add registry LWRP with login action
- Enhancement: Standardize on "smart" and reusable destination and source attributes for container and image LWRPs to define paths/URLs for various operations
- Enhancement: Add commit, cp, export, and kill actions to container LWRP
- Enhancement: Add insert, load, push, save, and tag actions to image LWRP
- Enhancement: Add local file and directory support to import action of image LWRP
- Enhancement: Add Array support to container LWRP link attribute
- Enhancement: Cleaned up LWRP documentation
0.24.2
- Bugfix: #43 Better formatting for container LWRP debug logging
0.24.1
- Bugfix: Explicitly declare depends and supports in metadata
- Bugfix: Handle container run action if container exists but isn't running
0.24.0
- Bugfix: #42 fix(upstart): Install inotify-tools if using upstart
- Enhancement: #38 Allow a user to specify a custom template for their container init configuration
0.23.1
- Bugfix: #39 Fix NoMethodError bugs in docker::aufs recipe
0.23.0
- Bugfix: Default oracle init_type to sysv
- Enhancement: Experimental Debian 7 package support
- Enhancement: Use new yum-epel cookbook instead of yum::epel recipe
- Enhancement: Use
value_for_platform
where applicable in attributes, requires Chef 11
0.22.0
- Enhancement: #35 Use kernel release for package name on saucy and newer
- Enhancement: #37 dont include aufs recipe on ubuntu 13.10 and up; don't require docker::lxc for package installs
0.21.0
- Enhancement: #31 More helpful cmd_timeout error messages and catchable exceptions for container (
Chef::Provider::Docker::Container::CommandTimeout
) and image (Chef::Provider::Docker::Image::CommandTimeout
) LWRPs
0.20.0
- Enhancement: Default to package install_type only on distros with known packages
- Enhancement: Initial Oracle 6 platform support via binary install_type
- Enhancement: Split out lxc recipe for default platform lxc handling
- Enhancement: Create cgroups recipe for default platform cgroups handling
0.19.1
- Bugfix: #30 apt-get throws exit code 100 when upgrading docker
0.19.0
- Enhancement: Add
node['docker']['version']
attribute to handle version for all install_type (recommended you switch to this) - Enhancement:
default['docker']['binary']['version']
attribute usesnode['docker']['version']
if set - Enhancement: Add version handling to package recipe
0.18.1
- Bugfix: Remove ExecStartPost from systemd service to match change in docker-io-0.7.0-13
0.18.0
- Enhancement: CentOS/RHEL 6 package support via EPEL repository
- Enhancement: Fedora 19/20 package support now in updates (stable) repository
- Enhancement: sysv recipe and init_type
0.17.0
- Removed: configuration recipe (see bugfix below)
- Removed: config_dir attribute (see bugfix below)
- Bugfix: Revert back to specifying HTTP_PROXY and "DOCKER_OPTS" natively in systemd/Upstart (mostly to fix up systemd support)
- Bugfix: Add systemctl --system daemon-reload handling to systemd service template
- Bugfix: Add || true to container systemd/Upstart pre-start in case already running
- Bugfix: Locale environment already handled automatically by systemd
- Enhancement: Switch Fedora package installation from goldmann-docker to Fedora updates-testing repository
- Enhancement: Switch container LWRPs to named containers on Fedora since now supported
- Enhancement: Update docker systemd service contents from docker-io-0.7.0-12.fc20
- Add: Wants/After firewalld.service
- Add: ExecStartPost firewall-cmd
- Remove: ExecStartPost iptables commands
0.16.0
- Bugfix: Remove protocol from docker systemd ListenStreams
- Bugfix: Lengthen shell_out timeout for stop action in container LWRP to workaround Fedora being slow
- Enhancement: Add service creation to container LWRP by default
- Please thoroughly test before putting into production!
-
set['docker']['container_init_type'] = false
or addinit_type false
for the LWRP to disable this behavior
- Enhancement: Add configuration recipe with template
- Enhancement: Add container_cmd_timeout attribute to easily set global container LWRP cmd_timeout default
- Enhancement: Add image_cmd_timeout attribute to easily set global image LWRP cmd_timeout default
- Enhancement: Add cookbook attribute to container LWRP
- Enhancement: Add init_type attribute to container LWRP
- Enhancement: Add locale support for Fedora
- Enhancement: Fail Chef run if
docker run
command errors
0.15.0
- Enhancement: Fedora 19/20 package support via Goldmann docker repo
- Enhancement: docker.service / docker.socket systemd support
- Enhancement: Add
node['docker']['init_type']
attribute for controlling init system
0.14.0
- Bugfix: #27 Only use command to determine running container if provided
- Bugfix: #28 Upstart requires full stop and start of service instead of restart if job configuration changes while already running. Note even
initctl reload-configuration
isn't working as expected from http://upstart.ubuntu.com/faq.html#reload - Enhancement: #26 Add ability to set package action
0.13.0
- Bugfix: Move LWRP updated_on_last_action(true) calls so only triggered when something actually gets updated
- Enhancement: Add container LWRP wait action
- Enhancement: Add attach and stdin args to container LWRP start action
- Enhancement: Add link arg to container LWRP remove action
- Enhancement: Use cmd_timeout in container LWRP stop action arguments
0.12.0
- Bugfix: Add default bind_uri (nil) to default attributes
- Enhancement: #24 bind_socket attribute added
0.11.0
- DEPRACATION: container LWRP Fixnum port attribute: use full String notation from Docker documentation in port attribute instead
- DEPRACATION: container LWRP public_port attribute: use port attribute instead
- Enhancement: Additional container LWRP attributes:
- cidfile
- container_name
- cpu_shares
- dns
- expose
- link
- lxc_conf
- publish_exposed_ports
- remove_automatically
- volumes_from
- Enhancement: Support Array in container LWRP attributes:
- env
- port
- volume
0.10.1
- Bugfix: Set default cmd_timeout in image LWRP to 300 instead of 60 because downloading images can take awhile
- Enhancement: Change docker_test Dockerfile FROM to already downloaded busybox image instead of ubuntu
- Enhancement: Add vagrant-cachier to Vagrantfile
Other behind the scenes changes:
* Made cookbook code Rubocop compliant
* Move licensing information to LICENSE file
* Updated .travis.yml and Gemfile
0.10.0
- Enhancement: #22 cmd_timeout, path (image LWRP), working_directory (container LWRP) LWRP attributes
- Bugfix: #25 Install Go environment only when installing from source
0.9.1
- Fix to upstart recipe to not restart service constantly (only on initial install and changes)
0.9.0
- image LWRP now supports non-stdin build and import actions (thanks @wingrunr21!)
0.8.1
- Fix in aufs recipe for FC048 Prefer Mixlib::ShellOut
0.8.0
Lots of community contributions this release -- thanks!
* image LWRP now supports builds via Dockerfile
* Additional privileged, public_port, and stdin parameters for container LWRP
* Support specifying binary version for installation
* Fix upstart configuration customization when installing via Apt packages
* Default to Golang 1.1
0.7.1
- Use HTTPS for Apt repository
0.7.0
- Update APT repository information for Docker 0.6+
0.6.2
- Change Upstart config to start on runlevels [2345] instead of just 3
0.6.1
- Change env HTTP_PROXY to export HTTP_PROXY in Upstart configuration
0.6.0
- Add bind_uri and options attributes
0.5.0
- Add http_proxy attribute
0.4.0
- Docker now provides precise/quantal/raring distributions for their PPA
- Tested Ubuntu 13.04 support
0.3.0
- Initial
container
LWRP
0.2.0
- Initial
image
LWRP
0.1.0
- Initial release
Foodcritic Metric
1.0.14 failed this metric
FC005: Avoid repetition of resource declarations: /tmp/cook/3a2972d8f68da09379bc6bbc/docker/libraries/provider_docker_service_systemd.rb:9
FC031: Cookbook without metadata file: /tmp/cook/3a2972d8f68da09379bc6bbc/docker/metadata.rb:1
FC045: Consider setting cookbook name in metadata: /tmp/cook/3a2972d8f68da09379bc6bbc/docker/metadata.rb:1
1.0.14 failed this metric
FC031: Cookbook without metadata file: /tmp/cook/3a2972d8f68da09379bc6bbc/docker/metadata.rb:1
FC045: Consider setting cookbook name in metadata: /tmp/cook/3a2972d8f68da09379bc6bbc/docker/metadata.rb:1