Vlad Khomich
Vlad Khomich

Reputation: 5880

docker: data volumes container

So I'm still trying to figure out what would be the best way to use docker in my current infrastructure.

I've been thinking of creating a data-volume containers, that containers would hold the data volume for mongodb (this seem to be pretty popular approach).

If I do that, how would I update the container without loosing the data inside it?

========== EDIT ==========

Clarification: I want to be able to "update" the container by, basically, rebuilding from Dockerfile. This means that I'll need to spin up a new container, but I want to keep the volumes from the old one

Upvotes: 3

Views: 1925

Answers (1)

Carlos Castellanos
Carlos Castellanos

Reputation: 2378

I think this might help you:

https://github.com/discordianfish/docker-backup

TL;DR: You just need to ensure that another container (such as: backup_monitor) is referencing the data volume and you will keep the volumes no matter what. Whether you rebuild your container or not, data volumes are meant to bypass the Union File System so it are kept while there is some container pointing to it. Another approach could be to share the data volumes with the docker host, using this way you can forget about data because is saved on the host directly. Hope it helps.

Upvotes: 2

Related Questions