The Wayback Machine - https://web.archive.org/web/20160305022013/https://docs.docker.com/swarm/reference/join/
Get Started
Quickstart containers Understand the architecture
Migrate to Engine 1.10 Breaking changes Deprecated Engine Features FAQ
Release Notes
Learn about Dockerfiles and Docker Cloud Back up data volumes Create a proxy or load balancer Install the Deploy to Docker Cloud button Integrate with Slack Push images to Docker Cloud SSHing into a Docker Cloud-managed node Upgrade Docker Engine on a node Use the Docker Cloud Agent Using the Docker Cloud CLI
API reference
Quickstart contribution FAQ for contributors Where to chat or get help Style guide for Docker documentation

join — Create a Swarm node

Prerequisite: Before using join, establish a discovery backend as described in this discovery topic.

The join command creates a Swarm node whose purpose is to run containers on behalf of the cluster. A typical cluster has multiple Swarm nodes.

To create a Swarm node, use the following syntax:

$ docker run swarm join [OPTIONS] <discovery>

For example, to create a Swarm node in a high-availability cluster with other managers, enter:

$ docker run -d swarm join --advertise=172.30.0.69:2375 consul://172.30.0.161:8500

Or, for example, to create a Swarm node that uses Transport Layer Security (TLS) to authenticate the Docker Swarm nodes, enter:

$ sudo docker run -d swarm join --addr=node1:2376 token://86222732d62b6868d441d430aee4f055

Arguments

The join command has only one argument:

<discovery> — Discovery backend

Before you create a Swarm node, create a discovery token or set up a discovery backend for your cluster.

When you create the swarm node, use the <discovery> argument to specify one of the following discovery backends:

  • token://<token>
  • consul://<ip1>/<path>
  • etcd://<ip1>,<ip2>,<ip2>/<path>
  • file://<path/to/file>
  • zk://<ip1>,<ip2>/<path>
  • [nodes://]<iprange>,<iprange>

Where:

  • <token> is a discovery token generated by Docker Hub’s hosted discovery service. To generate this discovery token, use the create command. > Warning: Docker Hub’s hosted discovery backend is not recommended for production use. It’s intended only for testing/development.

  • ip1, ip2, ip3 are each the IP address and port numbers of a discovery backend node.

  • path (optional) is a path to a key-value store on the discovery backend. When you use a single backend to service multiple clusters, you use paths to maintain separate key-value stores for each cluster.

  • path/to/file is the path to a file that contains a static list of the Swarm managers and nodes that are members the cluster.

  • iprange is an IP address or a range of IP addresses followed by a port number.

For example: * A discovery token: token://0ac50ef75c9739f5bfeeaf00503d4e6e * A Consul node: consul://172.30.0.165:8500

The environment variable for <discovery> is $SWARM_DISCOVERY.

For more information and examples, see the Docker Swarm Discovery topic.

Options

The join command has the following options:

Use --advertise <ip>:<port> or --addr <ip>:<port> to advertise the IP address and port number of the Docker Engine. For example, --advertise 172.30.0.161:4000. Swarm managers MUST be able to reach this Swarm node at this address.

The environment variable for --advertise is $SWARM_ADVERTISE.

--heartbeat — Period between each heartbeat

Use --heartbeat "<interval>s" to specify the interval, in seconds, between heartbeats the node sends to the primary manager. These heartbeats indicate that the node is healthy and reachable. By default, the interval is 60 seconds.

--ttl — Sets the expiration of an ephemeral node

Use --ttl "<interval>s" to specify the time-to-live (TTL) interval, in seconds, of an ephemeral node. The default interval is 180s.

--delay — Add a random delay in [0s,delay] to avoid synchronized registration

Use --delay "<interval>s" to specify the maximum interval for a random delay, in seconds, before the node registers with the discovery backend. If you deploy a large number of nodes simultaneously, the random delay spreads registrations out over the interval and avoids saturating the discovery backend.

--discovery-opt — Discovery options

Use --discovery-opt <value> to discovery options, such as paths to the TLS files; the CA’s public key certificate, the certificate, and the private key of the distributed K/V store on a Consul or etcd discovery backend. You can enter multiple discovery options. For example:

--discovery-opt kv.cacertfile=/path/to/mycacert.pem \
--discovery-opt kv.certfile=/path/to/mycert.pem \
--discovery-opt kv.keyfile=/path/to/mykey.pem \

For more information, see Use TLS with distributed key/value discovery

Mar 5, 2016 at 2:08am (PST) { "docker/apidocs": { "ref": "master", "repos": [ "[email protected]:docker/dhe-deploy.git" ], "sha": "70ac255c88cde0ea6ecf3fcb812783dea7e09da6" }, "docker/cloud-api-docs": { "ref": "master", "repos": [ "[email protected]:docker/cloud-docs.git" ], "sha": "c0539949c40be9abb193271e46d2ea88196f122d" }, "docker/cloud-api-docs-layout": { "ref": "master", "repos": [ "[email protected]:docker/cloud-docs.git" ], "sha": "c0539949c40be9abb193271e46d2ea88196f122d" }, "docker/compose": { "ref": "docs", "repos": [ "[email protected]:docker/compose.git" ], "sha": "9da9555f10abe628e7742476af3f10bd89f68b75" }, "docker/docker": { "ref": "docs", "repos": [ "[email protected]:docker/docker.git" ], "sha": "0e63b073ac8f33335a4d4df3f2aa22120e0b7f43" }, "docker/docker-cloud": { "ref": "master", "repos": [ "[email protected]:docker/cloud-docs.git" ], "sha": "c0539949c40be9abb193271e46d2ea88196f122d" }, "docker/docker-hub": { "ref": "master", "repos": [ "[email protected]:docker/hub2-demo.git" ], "sha": "73ccb2d678ab0cd83067f0c7ef6f3923d750c7bd" }, "docker/docker-trusted-registry": { "ref": "master", "repos": [ "[email protected]:docker/dhe-deploy.git" ], "sha": "70ac255c88cde0ea6ecf3fcb812783dea7e09da6" }, "docker/docs-base": { "ref": "master", "repos": [ "[email protected]:docker/docs-base.git" ], "sha": "5a4cfac3c4d156eda45080c7dcdd2a4c41e08067" }, "docker/kitematic": { "ref": "docs", "repos": [ "[email protected]:docker/kitematic.git" ], "sha": "856a989d834f7fcbcb9bba687539fb159228f6b8" }, "docker/machine": { "ref": "docs", "repos": [ "[email protected]:docker/machine.git" ], "sha": "21edf30337dc5996b5d785ce54d68b4020242f57" }, "docker/notary": { "ref": "docs", "repos": [ "[email protected]:docker/notary.git" ], "sha": "dfeb51f54f2b0cdf20cb55427b7cc8ea2d1cdd0a" }, "docker/opensource": { "ref": "master", "repos": [ "[email protected]:docker/opensource.git" ], "sha": "b994cdd1f74b0aeb0b51fda1249a0c4c8efbf0d0" }, "docker/registry": { "ref": "master", "repos": [ "[email protected]:docker/distribution.git" ], "sha": "33c4a6522e9247913fa0a9a2d78ef9a7aa98465f" }, "docker/swarm": { "ref": "docs", "repos": [ "[email protected]:docker/swarm.git" ], "sha": "b43a2c21c4017726cd9cb17ef9b16f2eef6d1159" }, "docker/toolbox": { "ref": "master", "repos": [ "[email protected]:docker/toolbox.git" ], "sha": "de267d701f94035549ea03e68047d85534286f85" }, "docker/tutorials": { "ref": "master", "repos": [ "[email protected]:docker/tutorials.git" ], "sha": "7af2622fe68a30684d971e4bf3ca7988902e5e26" }, "docker/ucp": { "ref": "master", "repos": [ "[email protected]:docker/orca.git" ], "sha": "8cd10936a1e063b9be0d5c04de7311a1b2cb25cf" }, "docs.docker.com": { "ref": "refs/heads/v1.10-030316", "repos": [ "[email protected]:moxiegirl/docs.docker.com.git", "[email protected]:docker/docs.docker.com.git" ], "sha": "b43886e4078ce481b06b4cee5c922f5bcc5c629f" } }