Skip to main content

Command Palette

Search for a command to run...

Demystifying Docker’s <none>:<none> Images

What dangling images actually are, why they're quietly eating your disk space, and how to safely purge them.

Updated
2 min read
P
Devsecops Engineer, Devops Professional Empowering security within SDLC

When you rebuild an image after modifying its Dockerfile, or reuse an existing image name and tag, what do you think Docker does behind the scenes?

It simply strips the repository name and tag from the older image and assigns them to the newly built one. But what happens to that old image? It gets left behind in a stateless limbo—becoming an untagged <none>:<none> ghost layer. In DevOps terms, we call these dangling images.

Technically, there are two variations of these <none> images you'll encounter:

  1. True Dangling Images: Unused layers that consume valuable disk space and clutter your environment.

  2. Intermediate/Staging Images: Cached layers used to speed up build times.


How to Create a Dangling Image

Let's look at a quick example. Suppose you have this initial Dockerfile:

Dockerfile

FROM alpine:3.14
ENTRYPOINT ["echo", "Hello from Alpine!"]

You build this image and tag it using the following command:

Bash

docker build -t hello-alpine:v1 .

Later, you decide to upgrade the base image. You update the Dockerfile to use a newer version of Alpine:

Dockerfile

FROM alpine:3.23
ENTRYPOINT ["echo", "Hello from Alpine!"]

If you build this updated file using the exact same tag (hello-alpine:v1), Docker assigns the tag to the new image. The original alpine:3.14 image loses its identity and instantly turns into a dangling <none>:<none> image.


What Are Staging (Intermediate) Images?

Not every <none> image is useless dead weight. When you execute a multi-stage build or create an image layer-by-layer, Docker creates intermediate staging images.

These act as a build cache. The next time you rebuild your image, Docker reuses these cached layers so you don't have to download or re-run identical instructions from scratch, making your CI/CD pipelines significantly faster.


How to Clean Them Up

Leaving true dangling images around will eventually bloat your host storage. Fortunately, removing them is simple. You can safely purge all dangling images with a single command:

Bash

docker image prune -f

Note: Using the -f (force) flag bypasses the confirmation prompt, making it ideal for automated cleanup scripts.