Leverage Spot Instances with Docker Swarm - Spot.io

Leverage Spot Instances with Docker Swarm

Reading Time: 2 minutes

Introduced in Docker engine v1.12, Swarm is Docker’s native support for orchestrating clusters of Docker engines. A Docker Swarm is a cluster of Docker engines, referred as nodes, which hosts services and tasks. Originally launched as a separate tool, Swarm now ships native with the Docker engine you’re already going to install and use. Hitting the sweet spot between super-easy setup and solid feature set, you owe it to yourself to check it out.

Today we are happy to announce that Docker Swarm has joined the long list of container management solutions supported by Spotinst (alongside other leading solutions- Kubernetes, Amazon ECS, Rancher, Mesosphere and more).

Why you should run your Docker Swarm Cluster on Spot Instances

As Spotinst vets already know, running your applications on Spot Instances saves you a lot of money.

Containers make the perfect use case for leveraging Spot instances, This is due to the fact that containers provide customers with the confidence to seamlessly deploy the same application to new hosts. The self-contained dependency model means that everything your application needs is available as part of a compressed archive (Docker Image) that is created upon build. This is especially true when running containerized applications on a cluster, such as Docker Swarm, that can automatically reschedule failed jobs and applications.

High-Level Architecture

Each node in a swarm has a role: a Manager or a Worker.

  • Manager nodes handle cluster management tasks:
    • Maintain cluster state
    • Schedule services
    • Serve swarm mode HTTP API endpoints
    • Service discovery
  • Worker nodes whole purpose is executing tasks 

Docker Swarm architecture

Integration with Elastigroup

Elastigroup lets you run Docker Swarm workers on EC2 spot instances in a reliable and cost-effective manner. Taking advantage of our predictive algorithm to identify interruptions in the spot market and operate in proactive fashion – replacing the interrupted spot instance with another one, gracefully. All with zero downtime.

Once an interruption is predicted, the relevant instance is marked for draining, another instance is launched and automatically joined to the swarm. The interrupted instance’s tasks are being rescheduled across the cluster.

Docker Swarm on Spot Instances

Getting Started with Docker Swarm on Spotinst

  1. Log in to your Spotinst console. (https://console.spotinst.com)
  2. Create a new elastigroup or edit an existing group, in the compute page scroll down to the Integrations section.
  3. Select Docker Swarm and enter the API URL and Port.
  4. Click Test connection to validate connectivity.

Docker Swarm Spotinst Integration

So what are you waiting for? Get your Swarm running on Spotinst now!