github.com/kobeld/docker@v1.12.0-rc1/docs/reference/commandline/swarm_init.md (about) 1 <!--[metadata]> 2 +++ 3 title = "swarm init" 4 description = "The swarm init command description and usage" 5 keywords = ["swarm, init"] 6 [menu.main] 7 parent = "smn_cli" 8 +++ 9 <![end-metadata]--> 10 11 **Warning:** this command is part of the Swarm management feature introduced in Docker 1.12, and might be subject to non backward-compatible changes. 12 13 # swarm init 14 15 Usage: docker swarm init [OPTIONS] 16 17 Initialize a Swarm. 18 19 Options: 20 --auto-accept value Acceptance policy (default [worker,manager]) 21 --force-new-cluster Force create a new cluster from current state. 22 --help Print usage 23 --listen-addr value Listen address (default 0.0.0.0:2377) 24 --secret string Set secret value needed to accept nodes into cluster 25 26 Initialize a Swarm cluster. The docker engine targeted by this command becomes a manager 27 in the newly created one node Swarm cluster. 28 29 30 ```bash 31 $ docker swarm init --listen-addr 192.168.99.121:2377 32 Initializing a new swarm 33 $ docker node ls 34 ID NAME STATUS AVAILABILITY/MEMBERSHIP MANAGER STATUS LEADER 35 3l1f6uzcuoa3 * swarm-master READY ACTIVE REACHABLE Yes 36 ``` 37 38 ### --auto-accept value 39 40 This flag controls node acceptance into the cluster. By default, both `worker` and `manager` 41 nodes are auto accepted by the cluster. This can be changed by specifing what kinds of nodes 42 can be auto-accepted into the cluster. If auto-accept is not turned on, then 43 [node accept](node_accept.md) can be used to explicitly accept a node into the cluster. 44 45 For example, the following initializes a cluster with auto-acceptance of workers, but not managers 46 47 48 ```bash 49 $ docker swarm init --listen-addr 192.168.99.121:2377 --auto-accept worker 50 Initializing a new swarm 51 ``` 52 53 ### `--force-new-cluster` 54 55 This flag forces an existing node that was part of a quorum that was lost to restart as a single node Manager without losing its data 56 57 ### `--listen-addr value` 58 59 The node listens for inbound Swarm manager traffic on this IP:PORT 60 61 ### `--secret string` 62 63 Secret value needed to accept nodes into the Swarm 64 65 ## Related information 66 67 * [swarm join](swarm_join.md) 68 * [swarm leave](swarm_leave.md) 69 * [swarm update](swarm_update.md)