0

I had changed the directory to store containers and images as /data/docker.And it work successfully in the coming one year.

However, after I reboot the system (Ubuntu 16.04), a disk partition /dev/sdb4 was broken,which was mount to /data/docker. And the broken partition lead to the system come into emergency mode. I run a command fsck -y /dev/sdb4 to repair it and restart again.

After restarting,all work normally as before except docker. It is amazing that all my container and almost images were missing. When I run docker container ls -a,I got nothing. When I run docker images,I only got one list mysql 5.6 7edb93321b06 5 months ago 256MB.But I had 4 containers and some (more than one) images before. In other words,they were gone after reboot.

In addition,when I run sudo du -h /data/docker/volumes,I got:

6.8M /data/docker/volumes/b35a0a2be6a1d10693e891f0b5c7dfa6e27a34b6a61384e6db79ac06df4bde36/_data/mysql 636K /data/docker/volumes/b35a0a2be6a1d10693e891f0b5c7dfa6e27a34b6a61384e6db79ac06df4bde36/_data/performance_schema 116M /data/docker/volumes/b35a0a2be6a1d10693e891f0b5c7dfa6e27a34b6a61384e6db79ac06df4bde36/_data 116M /data/docker/volumes/b35a0a2be6a1d10693e891f0b5c7dfa6e27a34b6a61384e6db79ac06df4bde36 4.0K /data/docker/volumes/4bfb7ca010e869edd409ee14aa3a8b9ec70ec144a1b1586e792a8f87f9d5a9b2/_data 8.0K /data/docker/volumes/4bfb7ca010e869edd409ee14aa3a8b9ec70ec144a1b1586e792a8f87f9d5a9b2 4.0K /data/docker/volumes/d24ddf0126cef08bc3ff8bf75e79e76375b1e6cfa70c646d3173554d78555aeb/_data 8.0K /data/docker/volumes/d24ddf0126cef08bc3ff8bf75e79e76375b1e6cfa70c646d3173554d78555aeb 4.0K /data/docker/volumes/c22f29c1ab50c2973e6e1cc3e1ea64ad7a253741d44a290df3789fbf1e4c3a05/_data 8.0K /data/docker/volumes/c22f29c1ab50c2973e6e1cc3e1ea64ad7a253741d44a290df3789fbf1e4c3a05 4.0K /data/docker/volumes/985f51b406657eacbd70dfe7d0bd0502287c783a389ae34fa36d70b5c98e94a3/_data/#innodb_temp 84K /data/docker/volumes/985f51b406657eacbd70dfe7d0bd0502287c783a389ae34fa36d70b5c98e94a3/_data/sys 32K /data/docker/volumes/985f51b406657eacbd70dfe7d0bd0502287c783a389ae34fa36d70b5c98e94a3/_data/mysql 84K /data/docker/volumes/985f51b406657eacbd70dfe7d0bd0502287c783a389ae34fa36d70b5c98e94a3/_data/test 1.4M /data/docker/volumes/985f51b406657eacbd70dfe7d0bd0502287c783a389ae34fa36d70b5c98e94a3/_data/performance_schema 165M /data/docker/volumes/985f51b406657eacbd70dfe7d0bd0502287c783a389ae34fa36d70b5c98e94a3/_data 165M /data/docker/volumes/985f51b406657eacbd70dfe7d0bd0502287c783a389ae34fa36d70b5c98e94a3 3.1G /data/docker/volumes/b445468b292cff4531429b7a9883a825fc794327a46672ec518e7765050437e5/_data/newProject 6.8M /data/docker/volumes/b445468b292cff4531429b7a9883a825fc794327a46672ec518e7765050437e5/_data/mysql 387M /data/docker/volumes/b445468b292cff4531429b7a9883a825fc794327a46672ec518e7765050437e5/_data/project 636K /data/docker/volumes/b445468b292cff4531429b7a9883a825fc794327a46672ec518e7765050437e5/_data/performance_schema 4.0G /data/docker/volumes/b445468b292cff4531429b7a9883a825fc794327a46672ec518e7765050437e5/_data 4.0G /data/docker/volumes/b445468b292cff4531429b7a9883a825fc794327a46672ec518e7765050437e5 4.2G /data/docker/volumes

It means that some of data is not lost.

How can I repair it and find them back ?

David Maze
  • 130,717
  • 29
  • 175
  • 215
XF Xu
  • 11
  • 1
  • 3
  • 2
    If you have one, restore the latest backup. Actually the volumes are more valuable, the images should not be hard to find somewhere else. – Henry Dec 31 '18 at 17:37
  • You've mentioned that you made path change to where Docker store images. After the reboot, have you checked if Docker looking at the same folder? – Prav Dec 31 '18 at 22:23
  • 1
    @PraveenP When I run `docker info |grep 'Docker Root Dir'`,I can get `Docker Root Dir: /data/docker` – XF Xu Jan 01 '19 at 07:03
  • @Henry It is sad that I run these containers for a long time without any backup.The only image(`mysql:5.6`) left is the base image which I pull down from the public repository. – XF Xu Jan 01 '19 at 07:14
  • Well at least the contents of the container still exist, you need to copy them to a new one. For the images, can you check in the [`/var/lib/docker`](https://stackoverflow.com/questions/19234831/where-are-docker-images-stored-on-the-host-machine) if they are still there, that's where it would be at. – Prav Jan 01 '19 at 12:54

0 Answers0