-
Notifications
You must be signed in to change notification settings - Fork 37
Add example on how to keep the DB #54
base: master
Are you sure you want to change the base?
Conversation
If the container is killed, the DB usually goes the same way. This example show how to keep the data even is the container dies.
@lmakarov looks like nice to have |
This would only make sense on Linux. On Mac and Windows (via boot2docker) @TLyngeJ can you please explain your use case? What would be the benefit of making |
The use case is, that sometimes you'll need to update the container, but won't like to spend the 30 minutes, it sometimes takes to import databases. And the purpose of this change is more to make people aware that it can be done, not enabling it by default. A comment could also make people aware of that this shouldn't be done, if you're running docker through a VM. |
@TLyngeJ There's a typo in a comment.
|
RE: persistant data: consider snapshotting dbs by "docker commit" to a new image tag? images are exportable and distributable, but commited images are big. Requires that you don't use "VOLUME /var/lib/mysql" |
@james-nesbitt this would mean no updates to container |
This aspect — losing a database on a container rebuild — came up in my Drude presentation to a TriDUG meetup. Excuse my weak docker knowledge, but could you use a container solely dedicated as a persistent storage volume for the mysql data? |
@achekulaev yeah good point. (you couldn't update the db base image without significant effort, if you kept a versioned db image with content) @kyleskrinak a versioned volume container is a good idea. It of course needs db image version pinning to be considered at the application layer, for cases where the /var/lib/mysql would be invalid with a newer db version. That would really suck for testing. |
If the container is killed, the DB usually goes the same way. This example show how to keep the data even is the container dies.