I'm using Docker to deploy some services on a CentOS 6.4 server, and I'm trying to figure out how to properly backup data they generate.
For example, one of the services is a web application where users can upload files. For this container, I have a
/files volume which I want to backup. Host mounts looks like they are somewhat frowned upon, because such mount is in no way portable — as said in this blog post and the docker documentation for volumes.
I know from the same blog post that I don't need a host mount to access the files in a volume, I can use
docker inspect to find out where the files are.
But here's my problem: I was thinking about backing up just the dockerfiles needed to build the containers and the volumes associated with them. In the likely event that I have to restore everything from the backup, how would I go about knowing which volume directory corresponds to which container? Rebuilding the container causes the id and the volume path to change, so I would need some extra information to match them. What else, if anything, should I backup to be able to actually restore everything?