Restore deleted container docker

eugene picture eugene · Mar 23, 2015 · Viewed 21.9k times · Source

I have a docker container that was running postgresql db but it was accidentally deleted by my Apache Mesos Marathon.

Is there any way I can restore the container or at least, get the database files?

Thanks

Answer

Adrian Mouat picture Adrian Mouat · Mar 23, 2015

If it's just stopped, rather than removed, you should be able to find it under docker ps -a and just run docker start CONTAINER.

Unless the database was removed with docker rm -v CONTAINER, the database files are probably still in a directory somewhere under /var/lib/docker/vfs/dir/, but you may have a hard time figuring out which one. If you do manage to figure out the correct directory, you should be able to restore the db by just mounting the directory into a new database instance.