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

0
0
Asked By MellowCedar42 On

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?

3 Answers

Answered By SilverPine88 On

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.

Answered By BrightMango7 On

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.

Answered By QuietOrbit19 On

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.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.