Create your FREE Codefresh account and start making pipelines fast. Create Account

Hello Whale: Images vs. Containers in Docker

2 min read

If you’re getting started with Docker, you’re probably hearing the word “container” or “image” quite a bit, but you’re probably wondering… what’s the difference? 🤔

To break things down simply…

An image is an application you would like to run.

A container is a running instance of an image.

In other words, you create a new container based on an image. Therefore, many containers can be run off the same image. So, a container is an instance of an image.


You can think about images and containers as a class and an instance of class. Here’s a simple example in Python:

class Whale(object):
 order = "Cetacea"
 suborder = "mysticeti"

 def __init__(self, name, location="ocean"): = name
 self.location = location

 def speak(self):
 return "EEEeooooOOOEOEOOooOOO, I'm {} the whale and I live in the
 {}.".format(, self.location)

whale_1 = Whale("Willy")

In this example, the image would be our class Whale and whale_1 would be a container. Simple, no?

Still confused?

Alright, here’s a metaphor:

Wow- skills!

Imagine you have a copy of a film that (because you are a hipster) you decide to buy a VHS of. In this example, the VHS would be your image. When you play this VHS on your VCR, the VCR would be your container (in that we are running the original VHS in it). In this example, the container (in this case, the VCR) is always tied directly to the image.

And to stretch this metaphor even further:

Imagine you had a DVD and BluRay of a film. These would be your images, while their respective players would be containers.

And to stretch this metaphor even more further:

Imagine you had a laser disk… (ok, you get the point). Same content- different environments.

And there you have it- a super simple way to remember the difference between containers and images!

Wow- ok lady. It’s just a VCR. Calm down.

🐳 To hear more beginner-friendly articles about Docker, follow me on Medium, or find me on Twitter @chloecondon 🐳


Leave a Reply

* All fields are required. Your email address will not be published.