Docker Swarm is native clustering for Docker. It turns a pool of Docker hosts into a single, virtual host.
Swarm serves the standard Docker API, so any tool which already communicates with a Docker daemon can use Swarm to transparently scale to multiple hosts: Dokku, Compose, Krane, Flynn, Deis, DockerUI, Shipyard, Drone, Jenkins... and, of course, the Docker client itself.
Like other Docker projects, Swarm follows the "batteries included but removable" principle. It ships with a simple scheduling backend out of the box, and as initial development settles, an API will develop to enable pluggable backends. The goal is to provide a smooth out-of-box experience for simple use cases, and allow swapping in more powerful backends, like Mesos, for large scale production deployments.
###1 - Docker image. The easiest way to get started with Swarm is to use the official Docker image.
docker pull swarm
###2 - Alternative: Download and install from source. Alternatively, you can download and install from source instead of using the Docker image.
Ensure you have golang and git client installed (e.g.
apt-get install golang git on Ubuntu).
You may need to set
mkdir ~/gocode; export GOPATH=~/gocode.
swarm binary to your
go get -u github.com/docker/swarm
###3 - Nodes setup
The only requirement for Swarm nodes is to run a regular Docker daemon (version
1.4.0 and later).
In order for Swarm to be able to communicate with its nodes, they must bind on a
network interface. This can be achieved by starting Docker with the
# create a cluster $ docker run --rm swarm create 6856663cdefdec325839a4b7e1de38e8 # <- this is your unique <cluster_id> # on each of your nodes, start the swarm agent # <node_ip> doesn't have to be public (eg. 192.168.0.X), # as long as the swarm manager can access it. $ docker run -d swarm join --addr=<node_ip:2375> token://<cluster_id> # start the manager on any machine or your laptop $ docker run -d -p <swarm_port>:2375 swarm manage token://<cluster_id> # use the regular docker cli $ docker -H tcp://<swarm_ip:swarm_port> info $ docker -H tcp://<swarm_ip:swarm_port> run ... $ docker -H tcp://<swarm_ip:swarm_port> ps $ docker -H tcp://<swarm_ip:swarm_port> logs ... ... # list nodes in your cluster $ docker run --rm swarm list token://<cluster_id> <node_ip:2375>
See here for more information about other discovery services.
Swarm supports TLS authentication between the CLI and Swarm but also between Swarm and the Docker nodes.
In order to enable TLS, the same command line options as Docker can be specified:
swarm manage --tlsverify --tlscacert=<CACERT> --tlscert=<CERT> --tlskey=<KEY> [...]
Please refer to the Docker documentation for more information on how to set up TLS authentication on Docker and generating the certificates.
Note that Swarm certificates must be generated with
extendedKeyUsage = clientAuth,serverAuth.
We welcome pull requests and patches; come say hi on IRC, #docker-swarm on freenode.
Copyright and license
Code and documentation copyright 2014-2015 Docker, inc. Code released under the Apache 2.0 license.
Docs released under Creative commons.
There is no documentation for this package.
Package cli provides a minimal framework for creating and organizing command line Go applications.
|Package cli provides a minimal framework for creating and organizing command line Go applications.|
Package context stores values shared during a request lifetime.
|Package context stores values shared during a request lifetime.|
Package gorilla/mux implements a request router and dispatcher.
|Package gorilla/mux implements a request router and dispatcher.|
objx - Go package for dealing with maps, slices, JSON and other data.
|objx - Go package for dealing with maps, slices, JSON and other data.|
A set of comprehensive testing tools for use with the normal Go testing system.
|A set of comprehensive testing tools for use with the normal Go testing system.|
Provides a system by which it is possible to mock your objects and verify calls are happening as expected.
|Provides a system by which it is possible to mock your objects and verify calls are happening as expected.|