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


swarm (4) Versions 0.1.0

Installs/Configures Docker Swarm

cookbook 'swarm', '= 0.1.0', :supermarket
cookbook 'swarm', '= 0.1.0'
knife supermarket install swarm
knife supermarket download swarm
Quality 0%

Swarm Cookbook

Chef cookbook for configuring Docker Swarm nodes.



Pulls the swarm image only. See manager.rb and worker.rb


Runs a swarm container in "manage" mode


Runs a swarm container in "join" mode


Uses the Docker cookbook resource to ensure that Docker is installed and running
The recipe uses minimal configuration, it is expected that most cookbook users will set up
Docker directly


Attribute Default Value Description
['swarm']['swarm_version'] 'latest' Version of the Swarm container to use
['swarm']['image']['read_timeout'] 180
['swarm']['discovery']['provider'] 'token' Swarm discovery provider type to use. Valid values are token, consul, etcd, zk, file
['swarm']['discovery']['token'] nil Discovery token to use, only used with provider "token"
['swarm']['discovery']['file_path'] nil Path to discovery file. Only used for provider "file"
['swarm']['discovery']['host'] nil Specify a host running the discovery service for the Swarm cluster. If not specified then a search will be run instead. Only used with provider "consul", "etcd" or "zk"
['swarm']['discovery']['query'] "role:swarm-discovery AND chef_environment:#{node.chef_environment}" When a discovery host is not specified the cookbook will attempt to find a discovery provider using the specified query. Only used with provider "consul", "etcd" or "zk"
['swarm']['discovery']['path'] nil Path to append to the end of the key value store URL. Only used with provider "consul", "etcd" or "zk"
['swarm']['restart_policy'] 'on-failure' Swarm container restart policy
['swarm']['discovery_options'] [] Discovery options passed in to the swarm containers
['swarm']['manager']['bind'] ''
['swarm']['manager']['port'] 3376
['swarm']['manager']['advertise'] node['ipaddress']
['swarm']['manager']['strategy'] 'spread'
['swarm']['manager']['replication'] false
['swarm']['manager']['replication_ttl'] '30s'
['swarm']['manager']['heartbeat'] nil
['swarm']['manager']['cluster_driver'] 'swarm'
['swarm']['manager']['cluster_options'] [] Cluster driver options
['swarm']['manager']['additional_options'] {} Hook for adding additional arguments to the swarm manage command. Specified as a Hash of argument names to values
['swarm']['worker']['ttl'] nil
['swarm']['worker']['heartbeat'] nil
['swarm']['worker']['delay'] nil
['swarm']['worker']['additional_options'] {} Hook for adding additional arguments to the swarm join command. Specified as a Hash of argument names to values


To create a managing node include swarm::manager in your node's run list
To create a worker node include swarm::worker in your node's run list

Both of the above recipes assume that the Docker engine will be installed and running.
swarm::service can be included if the engine is not managed through some other cookbook


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

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.

Dependent cookbooks

docker ~> 2.6

Contingent cookbooks

There are no cookbooks that are contingent upon this one.


Inital release

Foodcritic Metric

0.1.0 failed this metric

FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/861494dd109ca904734457bd/swarm/libraries/helpers.rb:91
FC003: Check whether you are running with chef server before using server-specific features: /tmp/cook/861494dd109ca904734457bd/swarm/libraries/helpers.rb:91