Four Ways to Run Docker on AWS

Chris Littlefield | Friday, September 27, 2019

Four Ways to Run Docker on AWS

When Docker was launched, many may have assumed that there would be a transfer of deployment power from operations teams to developers. On a smaller scale, that’s a fair assumption considering Docker’s promise to allow developers the ability to “Build, Ship and Run anywhere”. However, when scaling their deployments, developers quickly realized that architectural and operational complexities needed to be addressed the bigger their deployments became. It’s important for architects, operations teams and developers to work in concert to ensure that orchestration tools are used correctly to ensure scalability of their Docker applications.

There are several solutions available to assist developers when scaling to medium and large Docker implementations in the cloud. In this post, we will present an overview of four ways to deploy Docker on Amazon Web Services. We will summarize the Elastic Container Service (ECS), the Elastic Container Service for Kubernetes (EKS), AWS Fargate and finally deploying Docker on EC2.


Docker is a game-changer in terms of the deployment model. Instead of a full-blown operating system, Docker containers access the Linux kernel via the Docker daemon, or service (Docker can also be run on Windows). Docker containers are deployed from images, that contain all the code, libraries and other dependencies required for an application or microservice.  They can be launched in a matter of seconds, rather than the number of minutes it takes to launch a virtual machine. The key requirement is that the Docker daemon is installed and running on the host. A major benefit of this model means that Docker can be deployed the same way on your development laptop, your datacenter servers and in the cloud. 

Elastic Containers Service (ECS)

The Elastic Container Service provides developers with a service to securely deploy containers across a series of scalable clusters. If you are familiar with the Elastic Compute Cloud (EC2) service in AWS, the move to ECS will be relatively easy. You start by defining Tasks in ECS. In the task definition you define the container images you want to run on ECS and then set a schedule. Use the built-in scheduler in ECS or use a custom scheduler to launch the containers across the ECS cluster. You’ll use security groups as the firewalls for ECS, Amazon Machine Images (AMI) as templates for the underlying hosts and you’ll be able to deploy into one or more Virtual Private Clouds (VPC).

Elastic Container Service for Kubernetes (EKS)

EKS was launched to assist teams that were familiar and comfortable using Kubernetes as their Docker orchestration system. EKS works similarly to ECS, but it enables users to implement the Docker deployments with familiar Kubernetes commands and tools. You can deploy existing Kubernetes applications into EKS with little or no modification. EKS also uses EC2 hosts and tools like auto-scaling and load balancing to help scale your Docker deployments. As ECS does, you’ll be able to take advantage of Security Groups, AMIs and VPCs.

AWS Fargate

Both ECS and EKS give you the ability to have a more hands-off approach. The deployment option is called Fargate. Instead of choosing EC2 as the launch mode, you can select Fargate, and let AWS handle more of the orchestration and management of the clustering and scheduling of the clusters in either ECS or EKS. You need to give Fargate some inputs on tasks that you want to run, but the on-going clustering and scheduling is then managed by AWS.

Deploying Docker on EC2

You can run Docker on EC2 instances. Simply run a series of Docker commands manually, run scripts to automatically deploy, and similarly to the above service options, run the containers from images. For orchestration, you could use Docker Swarm, Kubernetes, Mesos and other orchestration tools. Please remember to manage everything from the operating system on up on EC2 so check out the Simple Systems Manager to assist with those tasks i.e. the Run command, and the patch manager, etc.

 View All Docker Training

Choosing Between Docker CE vs EE and Swarm vs Kubernetes

Choosing Between Docker CE vs EE and Swarm vs Kubernetes

You are likely familiar with containerization and the benefits it brings to your applications and data center. Docker democratized containers by providing a simple, efficient and cost-effective container implementation and management solution. This article helps you decide between Docker CE vs EE and Swarm vs Kubernetes.