DevOps Insights
HomeBlogForumGuidesRoadmapStart Here
Sign InExplore
HomeBlogForumGuidesRoadmapStart Here
Sign InExplore
DevOps Insights

Built by engineers, for engineers.

Your daily dose of DevOps — practical tutorials, Docker guides, and production strategies that actually work in the real world.

Get new posts by email

Subscribe to get an email when a new blog post is published. Skip anytime.

No spam, unsubscribe anytime.

Explore

  • All Articles
  • Forum
  • Guides
  • DevOps Roadmap
  • Tools & Resources
  • Glossary
  • RSS Feed

Company

  • About
  • Contact
  • Write for Us
  • Privacy Policy
  • Terms of Service

© 2026 DevOps Insights. All rights reserved.

PrivacyTermsRSS
GuidesDockerDocker ComposeDocker Swarm
Guides/Docker Swarm

Docker Swarm Guide

Docker Swarm turns a pool of Docker hosts into a single virtual host. You deploy services (with replicas) and the swarm schedules them across nodes. See official Swarm docs.

Last updated: April 2026

Check if Swarm is active

Swarm is part of Docker Engine. Check whether the current node is in swarm mode.

docker info | grep -i swarm

Initialize a swarm (manager node)

Run on the machine that will be the manager. Only run once per cluster.

docker swarm init

Deploy a stack

Save your compose file (e.g. stack.yml) and deploy. Use pre-built images (no build: in Swarm unless you build on each node).

docker stack deploy -c stack.yml mystack

Useful Swarm commands

docker service ls
docker node ls
docker service scale mystack_web=3
docker stack rm mystack

Sample stack file

Compose file suitable for docker stack deploy. Uses image only (no build).

services:
  web:
    image: nginx:alpine
    deploy:
      replicas: 2
      restart_policy:
        condition: on-failure
    ports:
      - "80:80"

SwarmBot

AI-powered assistant