AWS Theory | Understanding Containers: Docker, ECS, and EKS
📌 Notice
This is a Theory blog accompanying the blog post:
🔹 Episode 16: AWS Cloud Practitioner Quiz
🔹 Episode 16: AWS Solution Architect Preparation Quiz
Introduction
Welcome to this overview of containers! In this blog, we’ll dive into Docker, Amazon ECS (Elastic Container Service), and Amazon EKS (Elastic Kubernetes Service). These tools are essential for modern app deployment, making it easier to build, ship, and run applications consistently across environments.
What is Docker?
Docker is a powerful software development platform designed for deploying applications. At its core, it’s a container technology that packages apps into standardized units called containers. These containers can run on any operating system, ensuring your apps behave predictably no matter where they’re deployed — whether on a local machine, a server, or in the cloud.
This standardization eliminates compatibility issues, reduces maintenance effort, and simplifies deployment. Docker works seamlessly with any programming language, operating system, or technology stack.
Key Use Cases for Docker
- Microservices Architecture: Docker is ideal for breaking down applications into smaller, independent services.
- Lift and Shift Apps: Easily migrate applications from on-premises environments to the cloud.
- General Containerization: Anytime you need to run containerized workloads efficiently.
How Docker Works on an Operating System
Docker runs on a server, such as an Amazon EC2 instance (though it could be any server). You install a Docker agent (daemon) on the host, which allows you to start and manage Docker containers.
For example:
- One container might host a Java application.
- Another could run a Node.js application.
- You can even run databases like MySQL in containers.
Containers are versatile — you can run multiple instances of the same container (e.g., several Java app containers) on the same server. From the server’s perspective, everything is just a Docker container, making management straightforward.
Storing Docker Images
Docker images (the blueprints for containers) are stored in repositories. Here are the main options:
- Docker Hub: A public repository with base images for various technologies and operating systems, like Ubuntu or MySQL. It’s widely used and great for getting started.
- Amazon ECR (Elastic Container Registry): AWS’s managed service for private images. It also offers a public option via the Amazon ECR Public Gallery.
Docker vs. Virtual Machines: Key Differences
While Docker involves virtualization-like concepts, it’s not the same as traditional virtual machines (VMs). Docker containers share resources with the host system, allowing you to run many more containers on a single server compared to VMs.
Containers can share networking, data, and other resources, making them less isolated than VMs but more efficient. This efficiency is why Docker is so popular — it allows for higher density on servers.
Note: Docker is slightly less “secure” than VMs due to shared resources, but it’s optimized for performance and scalability.
Getting Started with Docker
Here’s the basic workflow to build and run Docker containers:
- Write a Dockerfile: This file defines your container’s structure, starting from a base image and adding your files or configurations.
- Build the Image: Use the Dockerfile to create a Docker image.
- Push to a Repository: Store the image in Docker Hub (public) or Amazon ECR (private/public).
- Pull and Run: Download the image from the repository and run it, which launches a Docker container executing your code.
This process ensures your app is portable and consistent.
Managing Docker Containers on AWS
AWS provides several services for orchestrating and managing Docker containers at scale:
- Amazon ECS (Elastic Container Service): AWS’s proprietary platform for running and managing Docker containers. It’s fully managed and integrates deeply with other AWS services.
- Amazon EKS (Elastic Kubernetes Service): AWS’s managed version of Kubernetes, an open-source orchestration tool. It’s great for teams already familiar with Kubernetes.
- AWS Fargate: A serverless compute engine for containers. It eliminates the need to manage servers and works with both ECS and EKS, allowing you to focus on your apps.
- Amazon ECR: As mentioned, for storing and managing container images securely.
This overview sets the stage for Docker and container management on AWS. In next post, we’ll deep-dive into Amazon ECS, EKS, Fargate, and more hands-on examples. Stay tuned! If you’re experimenting with containers, start with Docker Hub for quick prototypes and scale up with AWS services for production.
