swarm_init
Initialize a new Docker swarm manager on this Engine, including configuration for network addresses, autolock, and cluster recovery.
Instructions
Initialize a new swarm, making this Engine its first manager node.
Fails if the Engine is already part of a swarm — call swarm_leave first to reset it.
advertise_addr only needs setting when the host has multiple network interfaces or is
behind NAT (otherwise it is auto-detected); it must be reachable by every other node
that will join. To add more nodes afterwards, retrieve join tokens with
swarm_join_tokens and call swarm_join on each one. Set autolock_managers=True to
require the unlock key (swarm_unlock_key) on every manager restart — store that key
securely immediately, since it is only shown once autolock is enabled.
args: advertise_addr - Externally reachable address advertised to other nodes listen_addr - Listen address used for inter-manager communication force_new_cluster - Force a new single-node cluster from this node's current state (disaster recovery when a majority of managers is lost) default_addr_pool - IP address pools for swarm overlay networks subnet_size - Subnet size for the IP pool data_path_addr - Address to use for data path traffic data_path_port - Port number for data path traffic name - Name of the swarm labels - Labels to set on the swarm autolock_managers - Require the unlock key after every manager restart log_driver - Default log driver configuration returns: str - The node id of the newly created swarm manager
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | ||
| labels | No | ||
| log_driver | No | ||
| listen_addr | No | 0.0.0.0:2377 | |
| subnet_size | No | ||
| advertise_addr | No | ||
| data_path_addr | No | ||
| data_path_port | No | ||
| autolock_managers | No | ||
| default_addr_pool | No | ||
| force_new_cluster | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |