github.com/noxiouz/docker@v0.7.3-0.20160629055221-3d231c78e8c5/docs/swarm/key-concepts.md (about)

     1  <!--[metadata]>
     2  +++
     3  title = "Swarm mode key concepts"
     4  description = "Introducing key concepts for Docker Engine swarm mode"
     5  keywords = ["docker, container, cluster, swarm mode"]
     6  advisory = "rc"
     7  [menu.main]
     8  identifier="swarm-mode-concepts"
     9  parent="engine_swarm"
    10  weight="2"
    11  +++
    12  <![end-metadata]-->
    13  # Swarm mode key concepts
    14  
    15  This topic introduces some of the concepts unique to the cluster management and
    16  orchestration features of Docker Engine 1.12.
    17  
    18  ## Swarm
    19  
    20  The cluster management and orchestration features embedded in the Docker Engine
    21  are built using **SwarmKit**. Engines participating in a cluster are
    22  running in **swarm mode**. You enable swarm mode for the Engine by either
    23  initializing a swarm or joining an existing swarm.
    24  
    25  A **swarm** is a cluster of Docker Engines where you deploy
    26  [services](#Services-and-tasks). The Docker Engine CLI includes the commands for
    27  swarm management, such as adding and removing nodes. The CLI also includes the
    28  commands you need to deploy services to the swarm and manage service
    29  orchestration.
    30  
    31  When you run Docker Engine outside of swarm mode, you execute container
    32  commands. When you run the Engine in swarm mode, you orchestrate services.
    33  
    34  ## Node
    35  
    36  A **node** is an instance of the Docker Engine participating in the swarm.
    37  
    38  To deploy your application to a swarm, you submit a service definition to a
    39  **manager node**. The manager node dispatches units of work called
    40  [tasks](#Services-and-tasks) to worker nodes.
    41  
    42  Manager nodes also perform the orchestration and cluster management functions
    43  required to maintain the desired state of the swarm. Manager nodes elect a single leader to conduct orchestration tasks.
    44  
    45  **Worker nodes** receive and execute tasks dispatched from manager nodes. By
    46  default manager nodes are also worker nodes, but you can configure managers to
    47  be manager-only nodes. The agent notifies the manager node of the current
    48  state of its assigned tasks so the manager can maintain the desired state.
    49  
    50  ## Services and tasks
    51  
    52  A **service** is the definition of the tasks to execute on the worker nodes. It
    53  is the central structure of the swarm system and the primary root of user
    54  interaction with the swarm.
    55  
    56  When you create a service, you specify which container image to use and which
    57  commands to execute inside running containers.
    58  
    59  In the **replicated services** model, the swarm manager distributes a specific
    60  number of replica tasks among the nodes based upon the scale you set in the
    61  desired state.
    62  
    63  For **global services**, the swarm runs one task for the service on every
    64  available node in the cluster.
    65  
    66  A **task** carries a Docker container and the commands to run inside the
    67  container. It is the atomic scheduling unit of swarm. Manager nodes assign tasks
    68  to worker nodes according to the number of replicas set in the service scale.
    69  Once a task is assigned to a node, it cannot move to another node. It can only
    70  run on the assigned node or fail.
    71  
    72  ## Load balancing
    73  
    74  The swarm manager uses **ingress load balancing** to expose the services you
    75  want to make available externally to the swarm. The swarm manager can
    76  automatically assign the service a **PublishedPort** or you can configure a
    77  PublishedPort for the service in the 30000-32767 range.
    78  
    79  External components, such as cloud load balancers, can access the service on the
    80  PublishedPort of any node in the cluster whether or not the node is currently
    81  running the task for the service.  All nodes in the swarm cluster route ingress
    82  connections to a running task instance.
    83  
    84  Swarm mode has an internal DNS component that automatically assigns each service
    85  in the swarm a DNS entry. The swarm manager uses **internal load balancing** to
    86  distribute requests among services within the cluster based upon the DNS name of
    87  the service.
    88  
    89  ## What's next?
    90  * Read the [swarm mode overview](index.md).
    91  * Get started with the [swarm mode tutorial](swarm-tutorial/index.md).