cookbook 'docker_compose', '= 0.1.0', :supermarket
docker_compose (2) Versions 0.1.0 Follow5
Installs docker_compose and provides the docker_compose_application resource.
cookbook 'docker_compose', '= 0.1.0'
knife supermarket install docker_compose
knife supermarket download docker_compose
Docker Compose Cookbook
The Docker Compose Cookbook is a library cookbook that provides custom resources for use in recipes.
Requirements
- Working Docker installation. You might want to use the excellent docker Cookbook to provision Docker.
Usage
Place a dependency on the docker-compose cookbook in your cookbook's metadata.rb
depends 'docker_compose', '~> 0.0'
Create a Docker Compose file for the application you want to provision. A simple Compose file that uses the official nginx Docker image looks like this:
version: '2'
services:
web_server:
image: nginx
ports:
- "80:80"
Then, in a recipe:
include_recipe 'docker_compose::installation'
# Provision Compose file
cookbook_file '/etc/docker-compose_nginx.yml' do
source 'docker-compose_nginx.yml'
owner 'root'
group 'root'
mode 0640
notifies :up, 'docker_compose_application[nginx]', :delayed
end
# Provision Compose application
docker_compose_application 'nginx' do
action :up
compose_files [ '/etc/docker-compose_nginx.yml' ]
end
Attributes
node['docker_compose']['release']
- The release version of Docker Compose to install. Defaults to a sane, current default.node['docker_compose']['command_path']
- The path under which thedocker-compose
command should be installed. Defaults to/usr/local/bin/docker-compose
Resources Overview
docker_compose_application
The docker_compose_application
provisions a Docker application (that usually
consists of several services) using a Docker Compose file.
Example
docker_compose_application 'nginx' do
action :up
compose_files [ '/etc/docker-compose_nginx.yml', '/etc/docker-compose_nginx.additional.yml' ]
end
Parameters
project_name
- A string to identify the Docker Compose application. Defaults to the resource name.compose_files
- The list of Compose files that makes up the Docker Compose application. The specified file names are passed to thedocker-compose
command in the order in which they appear in the list.
Actions
:up
- Create and start containers. Equivalent to callingdocker-compose up
with the Compose files specified using thecompose_files
parameter.:down
- Stop and remove containers, networks, images, and volumes. Equivalent to callingdocker-compose down
with the Compose files specified using thecompose_files
parameter.
License & Authors
- Author:: Sebastian Boschert (sebastian@2007.org)
Dependent cookbooks
This cookbook has no specified dependencies.
Contingent cookbooks
Collaborator Number Metric
0.1.0 failed this metric
Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.
Foodcritic Metric
0.1.0 failed this metric
FC016: LWRP does not declare a default action: /tmp/d89e471ceaef29f3090c7bf0/docker_compose/resources/application.rb:1
FC064: Ensure issues_url is set in metadata: /tmp/d89e471ceaef29f3090c7bf0/docker_compose/metadata.rb:1
FC065: Ensure source_url is set in metadata: /tmp/d89e471ceaef29f3090c7bf0/docker_compose/metadata.rb:1
0.1.0 failed this metric
0.1.0 failed this metric
FC016: LWRP does not declare a default action: /tmp/d89e471ceaef29f3090c7bf0/docker_compose/resources/application.rb:1
FC064: Ensure issues_url is set in metadata: /tmp/d89e471ceaef29f3090c7bf0/docker_compose/metadata.rb:1
FC065: Ensure source_url is set in metadata: /tmp/d89e471ceaef29f3090c7bf0/docker_compose/metadata.rb:1