Data Containers backup/share an recreation docker host

I try to describe my situation and ask for help if someone had a similar experience.
I deploy containers on CoreOS hosts created by ansible. There is some application in container that store data in docker data container. This maybe mysql database files or sqlite database files. What would you do with this data containers to avoid data loss in case of damage CoreOS host or destroy and re-deploy this host?

We can mount /var/lib/docker to CoreOS host by NFS.
We can continous backup data in docker data containers by backup containers.

What would you do in such a situation?

Hi Vadim,

Here is what I will do:

  • After confirming that the directory is backed up regularly, I will NFS mount that directory in the CoreOS Host
  • In the Data Containers, I will mount that CoreOS Host’s directory as a VOLUME
  • Now containers what use this Data Container, may come and go, but I know that the data they create/manipulate is getting saved and backed up in the NFS mounted directory

Even if the CoreOS Host is destroyed, since I have the data backed up, I can re-create the env quite easily. Of course, I should know which containers to bring back up.


Thank you for tour answer, Joe. If I understood correctly, in that situation you:

  1. Use nfs to store application data
  2. Mount nfs share to CoreOS host
  3. Mount mounted folder to Docker Container.

I think that in this case we can mount host folder directly to Application Docker Container passing Docker Data Container. So tell long story short you will mount Host directory to container as VOLUME.

Yep, you got it.