Scale with Docker Swarm in 5 minutes

Docker is a containerization technology and Docker Swarm is a container orchestration tool.

I will use Ubuntu Desktop 20.04.02 LTS for this article.

Step 1: Get sample containerizated node.js web app

git clone

Step 2: Build the app

sudo docker image build -t myfirstcontainer .

Step 3: Configure Docker Swarm

sudo docker swarm init

Step 4: Create Docker Service with 5 replicas

sudo docker service create - name web -p 8080:8080 - replicas 5 myfirstcontainer .

Check docker images:

sudo docker images

Check container instances:

sudo docker container ls

Check out the node.js app to see which docker image instance is used when localhost:8080 requested:

Reference: Getting started with docker

  • Kubernetes scalability: Built-in with horizontal auto-scaling.
  • Swarm scalability: Auto-scaling groups.

Source: Docker Swarm vs Kubernetes