Repository navigation
Open
Description
Current behaviour
root@acme:~# docker container ls -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
39900d4aa961 registry.acme.io/core:4.47 "catalina.sh run" 4 days ago Up 4 days (healthy) 0.0.0.0:8080->8080/tcp, [::]:8080->8080/tcp core_app.1.trzd1zc12hp6cr7avcvahwrya
21af351e5098 nginx:1.29.2 "/docker-entrypoint.…" 4 days ago Up 4 days 0.0.0.0:80->80/tcp, [::]:80->80/tcp, 0.0.0.0:443->443/tcp, [::]:443->443/tcp core_proxy.1.s3fp15dvaryq0droxsl3jok7i
27db266adca1 ghcr.io/pellepelster/solidblocks-rds-postgresql:17-v0.4.6 "/rds/bin/run.sh" 4 days ago Up 4 days 5432/tcp core_db.1.f6wddqmo19q77x8xaoonqxy78
root@acme:~# docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
registry.acme.io/core <none> 40f97602d1eb 5 days ago 607MB
ghcr.io/pellepelster/solidblocks-rds-postgresql <none> a4d548f775a6 3 weeks ago 146MB
registry.acme.io/core 4.29 d6bb381c8b81 5 months ago 593MB
nginx <none> 657fdcd1c365 5 months ago 152MB
root@acme:~# docker system df
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
Images 4 3 1.499GB 593.4MB (39%)
Containers 3 3 566.6MB 0B (0%)
Local Volumes 5 5 26.73GB 0B (0%)
Build Cache 0 0 0B 0B
root@lagerinn:~# docker system prune -f
Total reclaimed space: 0B
Expected behaviour
Reclaimable space, ie. image
registry.acme.io/core 4.29 d6bb381c8b81
is removed.
Metadata
Metadata
Assignees
Labels
No labels
Activity
m-mahdi-abbaszade commentedon Jun 15, 2026
The reason
docker system prune -fisn't removing your old4.29image comes down to how Docker handles dangling vs. unused images, combined with a subtle detail hiding in your container names.Here is exactly what is happening and how to clean it up.
The Culprit: "Unused" vs. "Dangling" Images
By default,
docker system pruneonly removes dangling images.<none>:<none>). This usually happens when you build or pull a newer version of an image with the exact same tag, leaving the old layers orphaned.registry.acme.io/core:4.29), but is not actively being used by any container (running or stopped).Because your
4.29image still has its explicit name and tag, Docker considers it "unused," not "dangling." Therefore, a standard prune leaves it untouched to protect you from accidentally deleting an image you intentionally pulled or built.The Docker Swarm Factor
If you look at your
docker container ls -aoutput, your container names look like this:core_app.1.trzd1zc12hp6cr7avcvahwryaThose long, randomized hashes at the end mean these containers were deployed via Docker Swarm (or a similar orchestrator).
When Swarm performs a rolling upgrade or service update, it keeps old task definitions and history in its database. Even if a container isn't actively listed as running, Docker Swarm might still hold a hidden reference to that older
4.29image structure, which locks it down and blocks a standard cleanup.How to Force Reclaim the Space
To force Docker to clean up both dangling and tagged, unused images, you need to append the
-a(or--all) flag to your prune command.Run this instead:
Or, if you only want to target images specifically without touching other cached elements:
What if it still won't delete?
If you run
docker image prune -a -fand it still saysTotal reclaimed space: 0B, it means an existing container (or a hidden Swarm task history) is actively referencingd6bb381c8b81.You can break through this by forcing the removal directly via its Image ID:
(Note: If a running container is using it, this will warn you, but if it's just held up by old Swarm history, this will successfully untag and delete the image).