I was checking my Docker images in UGOS/Ugreen while doing routine updates and noticed several apparent duplicates. One image is currently running, another looks like the previous version, and some entries are shown as . The newer version has been working normally for several weeks. Are the older gray image and the red images safe to delete, or could they still be needed by existing containers?
3 Answers
The safest way to check is to look at every container, including stopped ones, because either type can still reference an image. You can run: docker ps -a --format '{{.Image}} {{.Status}}' | sort -u. For cleanup, docker image prune removes only untagged dangling images and is the safer option. docker image prune -a removes every image that no container references, so use that more carefully. Keeping one older version can also be useful as a rollback if the newest update has a problem.
The red entries are usually older image versions that lost their tags when a newer version was pulled. They are not necessarily errors. Docker also will not normally let you remove an image that a container still references, so deleting an unused image should not break the currently running container.
UGOS does not appear to prune old images automatically. If you update your Compose projects from the shell, you can pull and recreate them, then clean up dangling images afterward. For example: docker compose pull; docker compose create; docker compose start; docker image prune -f. Be sure to run the commands from the appropriate project directory.

So the green image is considered in use, while the red images can be deleted if no container references them? If a red image is still needed, Docker should refuse to remove it?