DEV Community

Ladipo Samuel
Ladipo Samuel

Posted on

Docker Explained (Part 2): Understanding Docker's Architecture, Images & Containers

One of the biggest mistakes people make when learning Docker is jumping straight into commands without understanding what's happening behind the scenes.
You'll see people type commands like:
docker run nginx

The application starts, everyone is happy, and they move on. But have you ever stopped to ask yourself: what actually happens after I press Enter?
It might seem like Docker is magically running your application, but it's actually following a simple process every single time.

Think of it like this:
You


Docker Client


Docker Engine


Docker Hub (if needed)


Docker Image


Docker Container


Running Application

Let's break this down.

Docker Client
The first component your command interacts with is the Docker Client.
Think of it as the messenger between you and Docker.

When you type: docker run nginx
The Docker Client doesn't create containers or download images. Its only responsibility is to receive your command and send it to the Docker Engine. A simple example is ordering food through an app. You place your order using the app, but the app doesn't prepare your meal. It simply sends your request to the restaurant: the Docker Client works exactly the same way.

Docker Engine
Once the Docker Client receives your command, it forwards it to the Docker Engine. If the Docker Client is the messenger, then Docker Engine is the brain. This is where the work happens.

The Docker Engine is responsible for:

  • Building Docker Images
  • Creating and starting Containers
  • Managing Docker Networks
  • Managing Docker Volumes
  • Pulling Images from Docker Registries

Without the Docker Engine, Docker simply cannot function. The first thing the Engine asks itself is: "Do I already have this image?"
If the answer is yes, Docker continues. If the answer is no, Docker needs somewhere to download it from. That's where Docker Hub comes in.

Docker Registry (Docker Hub)
A Docker Registry is simply a place where Docker Images are stored. The most popular registry is Docker Hub. Think of Docker Hub as GitHub but instead of hosting source code, it hosts Docker Images.
If Docker Engine can't find an image locally, it automatically reaches out to Docker Hub, downloads the image, stores it on your computer, and then continues the process. The nice thing is that Docker only downloads an image once.

The next time you run the same image, Docker simply uses the local copy, making the process much faster. Understanding this explains why your very first Docker command usually takes longer than every command after it.

Docker Images != Just a Blueprint
One of the most common explanations you'll hear is: "A Docker Image is a blueprint."
While that's true, it doesn't tell the whole story. A Docker Image is a complete, read-only package that contains everything your application needs to run.

That includes:

  • Your application code
  • Runtime (Python, Node.js, Java, etc.)
  • Dependencies
  • Required libraries
  • Configuration
  • Operating system packages

Think of it as a snapshot of your application at a particular point in time. Once an image is built, Docker treats it as immutable, meaning it doesn't change. If you modify your application, Docker doesn't update the existing image. Instead, it creates a completely new image.
At first, this might sound inefficient. In reality, it's one of Docker's biggest strengths. Because Images never change, every developer, testing environment, CI/CD pipeline, and production server runs exactly the same package.
That's one of the biggest reasons Docker became so popular: It removed the uncertainty of different environments.
Another important thing to know is that Images are not running. They simply exist, waiting to be used. You can think of an Image as a packaged application that's ready to be launched whenever you need it.

Docker Containers: Where Your Application Comes Alive
Here's something many beginners don't realize: docker never runs an Image directly. Instead, it creates a Container from that Image. A Container is simply the running instance of a Docker Image. Unlike Images, Containers are alive; they consume CPU; they use memory; they process requests; they respond to users.
They are the part that's actually executing your application. One of Docker's biggest advantages is that a single Image can create multiple Containers.

For example:

Every container starts from the exact same Image. That's why Docker delivers consistency. Instead of creating three different applications, Docker simply creates three running instances from the same package.
Containers are also designed to be temporary. If a container crashes, becomes corrupted, or is deleted, Docker doesn't expect you to repair it. You simply create another container from the original Image.
Since the Image never changed, the new Container behaves exactly like the previous one. This idea of treating containers as disposable is one of the biggest mindsets shifts Docker introduces. Instead of fixing running environments, you recreate them.

It's faster, cleaner and far more predictable.
Developer Tip: If there's one thing to remember from this section, let it be this:

  1. Images are packages. Containers are running applications.
  2. Docker never runs an Image directly; it always creates a Container from it.

Why Understanding These Concepts Matters Before Writing Your First Command
You may have noticed that we still haven't written a single Docker command and that's by design.
Learning Docker isn't about memorizing commands; it's about understanding what's happening every time you run one.
Once you understand how the Docker Client, Docker Engine, Docker Hub, Images, and Containers work together, Docker stops feeling complicated. The commands become logical because you know what's happening behind the scenes.

That's the purpose of this series: not just to teach you how to use Docker, but to help you understand why it works the way it does.
Now that we've built that foundation, it's time to put it into practice. In the next part, we'll build our first Docker Image and learn how a Dockerfile brings everything together.
.

Top comments (0)