Tous les articles

docker

Docker image vs container: what's the difference?

A plain-English guide to Docker images and containers, with the practical difference that matters when you deploy apps on a server.

  • docker
  • beginners
  • deployment
A layered Docker image card points with a green arrow to a running container card with a status light on a server baseline.

You open Docker and see both images and containers, and it feels like the same app is listed twice for no clear reason.

Short version: a Docker image is the packaged recipe for an app; a Docker container is a running copy made from that recipe. In the Docker image vs container question, the image is the reusable template, while the container is the actual thing using CPU, memory, ports, files, and network access on your server.

What is a Docker image?

A Docker image is like a boxed meal kit.

It contains the ingredients and instructions your app needs: the app code, the runtime it depends on, system libraries, and default settings. The image itself is not “doing” anything yet. It is sitting there, ready to be used.

If you have an image for a Node.js app, that image may include Node.js, your application files, and the basic environment the app expects. If you have an image for PostgreSQL, it contains the database software and its default layout.

Think of the image as a stamped copy of how something should be built. You can keep it, move it, download it again, or use it many times. Nothing meaningful happens until Docker starts a container from it.

This is why images are useful for deployment. Instead of rebuilding an app by hand on every server, you ship the same packaged app shape each time. If you are still getting comfortable with Docker itself, our beginner guide to Docker on a server gives the wider picture.

What is a Docker container?

A Docker container is what happens when the image is started.

If the image is the meal kit, the container is the meal being cooked in your kitchen. It uses real space, heat, pans, and time. On a server, that means CPU, memory, disk writes, network connections, and ports.

You can start several containers from the same image. They all begin from the same template, but each running container has its own life. One may be serving your website. Another may be a test copy. Another may have crashed because a setting was wrong.

This is the part that usually matters when something breaks. A container can stop, restart, fill its storage, fail health checks, or be unable to reach a database. The image may still be perfectly fine. The running container is where the live problem often shows up.

When you read logs, you are usually reading what a container did after it started. If that part feels murky, this guide to reading server logs when something breaks will help.

Docker image vs container: what actually changes?

The practical difference is state.

An image is meant to be stable and repeatable. A container is active and changeable. It may create files, accept traffic, crash, restart, or connect to other containers.

Here is the simplest way to separate them:

QuestionDocker imageDocker container
What is it?A packaged template for an appA running instance made from an image
Is it active?NoYes, when started
Does it use CPU and memory?Not by itselfYes
Can many exist from one source?One image can be reusedMany containers can come from one image
What breaks at runtime?Usually not the image itselfPorts, settings, files, memory, networking, permissions

This distinction matters when you update an app.

Pulling or building a new image does not automatically mean your live app changed. The running container may still be using the old image until it is replaced. That is why people sometimes say, “I updated it, but nothing changed.” They updated the box on the shelf, not the thing currently running.

It also matters when cleaning up disk space. Old images can pile up like unused boxes. Stopped containers can pile up like abandoned workbenches. They are related, but they are not the same mess.

Why do people mix up Docker images and containers?

Because Docker hides a lot of the machinery for good reasons.

In older server setups, you installed software directly onto the server. The app, its dependencies, its files, and its running process all felt like one thing. Docker splits that into layers: the packaged image, the running container, the attached storage, and the network around it.

That split is powerful, but it creates beginner traps.

You may delete a container and think you deleted the image. You may rebuild an image and think the running container changed. You may restart a container and expect lost files to come back, even though they were stored inside the container instead of in persistent storage.

Persistent storage means data that is meant to survive when the container is replaced. Databases, uploads, user files, and generated content usually need this. Without it, replacing a container can feel like swapping a notebook for a fresh blank one.

The same idea shows up when hosting several projects on one server. Each project needs clear boundaries, or one app’s ports, files, or settings can collide with another. We cover that broader hosting problem in hosting multiple websites on one server.

FAQ

Can a Docker image run by itself? No. A Docker image must be started as a Docker container before it does anything.

Can I have multiple containers from one image? Yes. One image can be used to create many containers, like printing many forms from one template.

If I delete a container, do I delete the image too? Usually no. The image can remain on the server and be used again later.

If I update an image, does my container update automatically? No. The running container normally has to be replaced or recreated from the newer image.

Where is my app’s data stored? It depends on the setup. Important data should live in persistent storage, not only inside a disposable container.

The shortcut

Server Manager helps by keeping the image, the running app, and the attached data understandable as separate pieces. That means you are less likely to confuse “I downloaded a new image” with “my live app is now updated,” or delete the wrong thing while trying to clean up.

It also helps when you come back months later. The real benefit is not having to reverse-engineer which container belongs to which project, which domain points to it, and where its data lives. That legibility saves you from common Docker failure modes: one project breaking another, a replaced container losing files, or an old setup becoming too scary to touch.

You still get the outcome Docker is good at: repeatable apps that can be updated and moved without turning the whole server into a mystery box.

What should you remember?

A Docker image is the recipe. A Docker container is the running meal.

Once you keep that split in your head, Docker becomes much less strange. Images are what you build, pull, store, and reuse. Containers are what run, fail, restart, accept traffic, and need clear data handling.

That one distinction makes troubleshooting calmer: you know whether you are looking at the template on the shelf or the live app on your server.