Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
pluginagentmarketplace avatar

Docker Swarm

  • 61 installs
  • 2 repo stars
  • Updated January 5, 2026
  • pluginagentmarketplace/custom-plugin-docker

Docker Swarm is an agent skill that provides a production-ready Docker Swarm stack template for replicated web and API services with updates, healthchecks, configs, and secrets.

About

Docker Swarm is an agent skill packaged as a production-oriented stack template for solo builders who self-host APIs and web fronts without adopting Kubernetes complexity. It encodes replicated nginx and application services, separated frontend, backend, and database networks, rolling update policies with automatic rollback, placement on worker nodes, and health-based orchestration. Config and secret references show how to wire TLS and database passwords in Swarm-native fashion. Use it when you already containerize with Docker and want HA-ish defaults on a small VPS fleet or homelab cluster. The skill is template-first: adapt image tags, replica counts, and constraint labels to your nodes, then deploy with docker stack deploy -c swarm-stack.yaml myapp.

  • swarm-stack.yaml version 3.8 with docker stack deploy workflow
  • Web service: 3 replicas, start-first updates, rollback on failure, CPU and memory limits
  • API service: 2 replicas with database network segmentation
  • Healthchecks on web (wget spider /health) with interval, timeout, and retries
  • Configs and secrets mounts for nginx TLS and database credentials

Docker Swarm by the numbers

  • 61 all-time installs (skills.sh)
  • +1 installs in the week ending Jul 26, 2026 (Skillselion tracking)
  • Ranked #652 of 1,453 DevOps & CI/CD skills by installs in the Skillselion catalog
  • Security screen: HIGH risk (skills.sh audit)
  • Data as of Jul 26, 2026 (Skillselion catalog sync)
npx skills add https://github.com/pluginagentmarketplace/custom-plugin-docker --skill docker-swarm

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs61
repo stars2
Security audit1 / 3 scanners passed
Last updatedJanuary 5, 2026
Repositorypluginagentmarketplace/custom-plugin-docker

What it does

Deploy a production-style Docker Swarm stack with replicas, rollbacks, healthchecks, configs, and secrets.

Who is it for?

Best when you're running Docker Swarm on a few Linux workers and want nginx plus API patterns out of the box.

Skip if: Skip if you're on managed Kubernetes, serverless-only deploys, or local docker-compose dev with no Swarm cluster.

When should I use this skill?

When deploying or hardening a multi-service app on Docker Swarm using a production stack file.

What you get

You deploy a named stack with defined replica counts, failure rollback behavior, and network segmentation ready to customize for your cluster.

  • swarm-stack.yaml stack definition
  • Service replica, update, and rollback policies
  • Network, config, and secret wiring pattern for web and API tiers

By the numbers

  • Compose file version 3.8
  • Web deploy replicas: 3; API deploy replicas: 2
  • Healthcheck interval 30s, timeout 10s, retries 3

Files

SKILL.mdMarkdownGitHub ↗

Docker Swarm Skill

Master Docker Swarm for container orchestration, cluster management, and production deployments.

Purpose

Set up and manage Docker Swarm clusters for high availability, service scaling, and production orchestration.

Parameters

ParameterTypeRequiredDefaultDescription
managersnumberNo3Number of manager nodes
workersnumberNo-Number of worker nodes
encryptedbooleanNotrueEncrypt overlay networks

Cluster Setup

Initialize Swarm

# Initialize on first manager
docker swarm init --advertise-addr <MANAGER_IP>

# Get join tokens
docker swarm join-token worker
docker swarm join-token manager

# Join as worker
docker swarm join --token <WORKER_TOKEN> <MANAGER_IP>:2377

# Join as manager
docker swarm join --token <MANAGER_TOKEN> <MANAGER_IP>:2377

High Availability (3 or 5 managers)

# Manager quorum: N/2 + 1
# 3 managers = tolerates 1 failure
# 5 managers = tolerates 2 failures

Service Deployment

Basic Service

# Create service
docker service create \
  --name webapp \
  --replicas 3 \
  --publish 80:80 \
  nginx:alpine

# Scale
docker service scale webapp=5

# Update image
docker service update --image nginx:1.25-alpine webapp

# Rollback
docker service rollback webapp

Full Service Configuration

docker service create \
  --name api \
  --replicas 3 \
  --network backend \
  --publish 8080:3000 \
  --mount type=volume,source=data,target=/data \
  --secret db_password \
  --env NODE_ENV=production \
  --limit-cpu 0.5 \
  --limit-memory 512M \
  --update-delay 10s \
  --update-parallelism 1 \
  --update-failure-action rollback \
  --health-cmd "curl -f http://localhost:3000/health" \
  --health-interval 30s \
  myapp:latest

Stack Deployment

Production Stack

# stack.yaml
services:
  frontend:
    image: frontend:${VERSION:-latest}
    deploy:
      replicas: 3
      placement:
        constraints:
          - node.role == worker
      update_config:
        parallelism: 1
        delay: 10s
        failure_action: rollback
      resources:
        limits:
          cpus: '0.5'
          memory: 256M
    ports:
      - "80:80"
    networks:
      - frontend
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost/health"]
      interval: 30s

  backend:
    image: backend:${VERSION:-latest}
    deploy:
      replicas: 3
    secrets:
      - db_password
    networks:
      - frontend
      - backend

networks:
  frontend:
    driver: overlay
  backend:
    driver: overlay
    internal: true

secrets:
  db_password:
    external: true
# Deploy stack
docker stack deploy -c stack.yaml myapp

# List services
docker stack services myapp

# Remove stack
docker stack rm myapp

Secrets & Configs

Secrets

# Create secret
echo "password" | docker secret create db_password -

# Use in service
docker service update --secret-add db_password myservice

# Rotate secret
echo "newpassword" | docker secret create db_password_v2 -
docker service update \
  --secret-rm db_password \
  --secret-add source=db_password_v2,target=db_password \
  myservice

Configs

# Create config
docker config create nginx_config ./nginx.conf

# Use in service
docker service create \
  --config source=nginx_config,target=/etc/nginx/nginx.conf \
  nginx

Node Management

# List nodes
docker node ls

# Drain node (maintenance)
docker node update --availability drain <node>

# Activate node
docker node update --availability active <node>

# Add label
docker node update --label-add role=database <node>

# Promote to manager
docker node promote <node>

# Demote from manager
docker node demote <node>

Error Handling

Common Errors

ErrorCauseSolution
no suitable nodeConstraints not metRelax or add nodes
not convergingHealth check failingCheck service logs
Raft: no leaderQuorum lostRestore managers

Manager Recovery

# If quorum lost, force new cluster
docker swarm init --force-new-cluster --advertise-addr <IP>

Troubleshooting

Debug Checklist

  • [ ] Swarm active? docker info | grep Swarm
  • [ ] Nodes healthy? docker node ls
  • [ ] Service running? docker service ls
  • [ ] Tasks placed? docker service ps <svc>

Diagnostics

# Service status
docker service ls

# Task status
docker service ps <service> --no-trunc

# Service logs
docker service logs -f <service>

# Node issues
docker node inspect <node> --pretty

Usage

Skill("docker-swarm")

Assets

  • assets/swarm-stack.yaml - Stack template
  • scripts/swarm-init.sh - Init script

Related Skills

  • docker-networking
  • docker-security
  • docker-production

Related skills

How it compares

Swarm stack template skill, not an MCP server or single-container dev compose snippet.

FAQ

Who is docker-swarm for?

Developers and tiny ops teams self-hosting with Docker Swarm who need a starting production stack rather than writing deploy YAML from scratch.

When should I use docker-swarm?

In Operate infra when promoting containerized web and API services to a Swarm cluster with healthchecks, rolling updates, and secrets.

Is docker-swarm safe to install?

It is declarative YAML referencing images and secrets; review the Security Audits panel on this page and replace example images and credentials before production.

DevOps & CI/CDdeployinfra

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.