✦ For everyone, free.

Practical knowledge for real and everyday life

Home

13.2.2.3 Swarm Delivery Target

A focused guide to Swarm Delivery Target, connecting core concepts with practical Docker and container operations.

A Swarm delivery target deploys an application as a Swarm stack, distributing its services across multiple nodes in a cluster, providing built-in load balancing, replica management, and rolling update capabilities that a single-host deployment approach can't offer.

Deploying a Stack to a Swarm Cluster

A stack deployment uses Swarm's own stack file format, similar to but distinct from a standard Compose file, deploying across the cluster's available nodes.

docker stack deploy -c docker-stack.yml mystack

This command distributes the stack's defined services across the Swarm cluster's nodes, according to each service's specified replica count and any placement constraints.

Why Swarm Provides Redundancy a Single Server Target Cannot

With multiple replicas of a service distributed across different nodes, the failure of any single node doesn't necessarily take the entire application down, unlike a single server deployment's inherent single point of failure.

services:
  app:
    image: registry.example.com/myapp:1.0
    deploy:
      replicas: 3

Three replicas, potentially distributed across different nodes, provide redundancy that a single-instance deployment simply cannot.

Performing a Rolling Update Through Swarm

Updating a deployed stack's image triggers Swarm's built-in rolling update mechanism, replacing instances gradually rather than all at once.

docker service update --image registry.example.com/myapp:2.0 mystack_app

This gradually replaces running instances with the new version, maintaining service availability throughout the update rather than taking everything down simultaneously.

Why Choosing Swarm Means Accepting Its Specific Operational Model

Swarm requires actually maintaining a cluster of nodes, joined together and kept healthy, a meaningfully greater operational commitment than a single server or single-host Compose deployment.

docker node ls
Why a Swarm Delivery Target Matters

Choosing Swarm as a delivery target provides genuine redundancy, load balancing, and rolling update capability beyond what single-host approaches offer, appropriate for an application that has actually grown to need this level of resilience and operational sophistication.