I've been running a project using Docker for over two months without issues, but recently I discovered that the **nginx** service had stopped working. When I checked the server logs, I found that **all of my Docker containers were deleted**, along with **all the images**. I tried to restart everything with `docker compose up -d`, but it didn't help. I'm confused and worried about what could have caused this. Is there any explanation or known issue that could lead to all of my containers and images being wiped out?
5 Answers
It's crucial to note that while containers can vanish when stopped, images typically shouldn't go anywhere unless they are deleted intentionally. It sounds like either something serious happened, or someone manually deleted them. Given your situation, the likelihood of a manual delete is higher than a system failure.
Try running `docker system df -v` to gather more insights. It might show your images and containers status, along with their sizes. It could reveal if anything was cleaned up unexpectedly.
I checked, and the images and containers look normal, but the cache section has some entries from the time right before they disappeared. Does that hint at anything specific?
If both `docker image ls -a` and `docker container ls -a` return empty, then something has likely been cleaned up, possibly manually or via an automated process. Has anyone with access done a `docker prune`? Also, ensure that the correct Docker context is being used; accidental context switches can lead to unintended cleanup actions.
If you're missing all containers and images, first check your Docker `data-root` path, typically located at `/var/lib/docker`. Make sure it's not mounted to an unusual location like an external drive that might have been disconnected. Also, take a look at the Docker daemon logs; they might contain relevant info about what happened. If you're running multiple Docker daemons, it could be possible you accidentally switched contexts. Verify this with `docker context ls`. Another thing to consider is if you’re using Docker on Windows — updates might occasionally mess with the WSL backend, resulting in a reset. Without further details, it's tricky to pinpoint the exact cause. I've had the experience where a simple user error led to a similar issue!
That's interesting, thanks! I haven’t checked if the data-root path is different. I'll look into the logs as well.
Check if the images were actually deleted or if they just got updated. If you're using the `:latest` tag for nginx, it may download a new version and appear as if the old one is gone. Run `docker images` to see what’s listed, and if it comes back empty, something else is at play here.
When I run the command `docker images`, it returns empty... so what now?

How can I check if that's what happened? I encountered the same issue today on my desktop.