Explaining the Difference between Amazon Machine Image (AMI) and Docker Image

The aim of this page📝 is to explain the concept of Amazon Machine Images (AMIs) and Docker images, based on the particular example of using these technologies in the AWS ecosystem. I find it confusing that the concept of an “image” is used in two different layers of infrastructure.

Pavol Kutaj
2 min readDec 26, 2023
  • AMIs and Docker images are different layers of the infrastructure in AWS.
  • AMIs are virtual machine images used in AWS.
  • Docker images are lightweight, standalone, executable software packages.
  • AMIs contain the information required to launch an instance in AWS.
  • Docker images include everything needed to run a piece of software.
  • AMIs are essentially whole machine images from which you can start new instances.
  • Docker images are used to create Docker containers, which are more portable and can run on any platform that supports Docker.
  • In AWS, you cannot deploy a Docker image/container on an EC2 instance without an AMI.
  • The EC2 instance exists only if you provide an AMI first, and many Docker containers (running images) will run on this single EC2/AMI.
  • Docker provides portability and speed, AMIs are used for greater isolation, consistency, and are ideal for Amazon-specific environments with stricter infrastructure needs.
  • Both Docker and virtual machines use the term “image”, but they refer to different things.
  • A Docker image is a blueprint for creating Docker containers.
  • An AMI is a snapshot of a virtual machine at a particular point in time.
  • A custom AMI can contain Docker images.
  • When you create a custom AMI, you’re creating a snapshot of a configured EC2 instance.
  • If you have Docker installed on this instance and you’ve pulled or built Docker images on it, these images will be part of the filesystem and thus included in the AMI.
  • Docker images are not inherently part of the AMI in the same way that installed software is. They exist as part of the filesystem of the Docker host (the EC2 instance).
  • Docker containers (running instances of Docker images) would not be running automatically when the EC2 instance starts. You would need to configure the EC2 instance to start the Docker service and run the necessary Docker containers on startup.
  • While there’s no direct way to create an AWS AMI out of a Docker image, you can include Docker images in an AMI by installing Docker and pulling or building the images on an EC2 instance, and then creating an AMI from that instance.

SOME LINKS

--

--

Pavol Kutaj

Today I Learnt | Infrastructure Support Engineer at snowplow.io with a passion for cloud infrastructure/terraform/python/docs. More at https://pavol.kutaj.com