Why Did My ROS 2 Docker Container Disappear After a Month?

August 27, 2026 3 answers
Asked by MellowCedar42
I'm using a Raspberry Pi 4B with a container based on a ROS 2 image. I stepped away from programming for about a month while working on a NAS project, and when I came back, the ROS 2 container was gone. I checked Docker's recent activity and couldn't find any record of a docker rm command or other obvious deletion during the past couple of months. What could cause a container to disappear like this, and how can I determine what happened?

Answers

QuietOrbit19
Check whether Dockerโ€™s data directory is on an external drive that failed to mount. On a Raspberry Pi, Docker may appear empty if `/var/lib/docker` is located on a drive that is currently unavailable. These commands can help verify the mounts and filesystem: `lsblk -f`, `blkid`, `df -h -T`, `findmnt`, and `cat /etc/fstab`. If the drive is mounted again, the container may become visible without being restored.

MellowCedar42: Iโ€™ll check the drive and mount settings. Sometimes I get so stuck on these problems that Iโ€™m not sure what to investigate next.

Reply to this answer
BrightMango7
First check whether the image and container still exist with `docker images` and `docker ps -a`. If the images are present but the container is missing, the most likely causes are that it was started with `--rm`, which automatically deletes it when it stops, or that a cleanup command such as `docker system prune` removed stopped containers. A reboot during that time could have triggered the issue if `--rm` was used. For the future, keep the setup in a Docker Compose file so the container can be recreated easily.

MellowCedar42: That `--rm` option is easy to overlook in tutorial commands, so it may explain what happened.

Reply to this answer
SilverPine88
First determine whether the container data is actually gone or whether Docker is using a different data root. You can inspect `/var/lib/docker/containers/`; directories with long hexadecimal names indicate that container data may still be there. If the directory is empty, possible causes include a scheduled `docker system prune`, starting the container with `--rm`, or filesystem corruption on the Piโ€™s SD card. For corruption, check `dmesg -T | grep -iE "ext4|i/o error"` and inspect `lost+found`. Also, `docker events` is not a long-term audit logโ€”it only reports events while it is runningโ€”so Docker itself may not have a record of what happened. A Compose file stored with the project will make recovery much easier next time.
Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions