Lecture 4: Docker Swarm

🐳 Docker Orchestration: From Standalone Containers to Swarm #

Docker Architecture

⚠️ Limitations of Standalone Docker Containers #

Running a production application using just standalone Docker containers—without orchestration—can lead to several challenges and operational risks:

💥 Single Point of Failure #

  • If the container crashes due to an application bug, out-of-memory error, or underlying issue, there’s no automatic recovery
  • The application will remain down until someone manually restarts the container, causing unwanted downtime

📊 Lack of Auto-Scaling #

  • In standalone mode, Docker does not provide any built-in mechanism to scale horizontally based on CPU, memory, or user demand
  • If traffic increases suddenly—such as during a flash sale or peak usage hour—your single container may become overwhelmed and unresponsive
  • This leads to degraded performance or complete service unavailability

⚖️ No Load Balancing #

  • Without orchestration, you typically run a single container instance
  • This limits the application’s ability to serve multiple users effectively
  • If you try to run multiple containers manually, there’s no built-in load balancing across them

🖥️ Host Dependency #

  • If the physical or virtual host machine goes down—whether due to hardware failure, a crash, or maintenance—all containers on that host go down with it
  • There’s no failover or container migration, which makes high availability difficult

🩺 No Health Check & Auto-Restart Logic #

  • While Docker does support basic restart policies, it lacks intelligent health monitoring
  • If your container is running but the app inside is stuck or returning errors, Docker won’t automatically restart it unless it crashes completely

📋 No Centralized Management or Logging #

  • Managing multiple containers across environments becomes tedious
  • You don’t get a central dashboard, logging, or monitoring unless you integrate separate tools
  • This increases operational complexity

🔄 Manual Networking and Configuration #

  • Networking between containers must be configured manually, which can become complex in multi-container setups
  • Secrets management, config updates, and port management lack the dynamic capabilities provided by orchestrators