3 ms·
Nothing is stopping you from running MySQL in Docker on native xfs with aligned partitions: bind-mount whatever partition you want into the container by definin
by vidarh 12y ago
Nothing is stopping you from running MySQL in Docker on native xfs with aligned partitions: bind-mount whatever partition you want into the container by defining a volume in Docker.
This will be persistent, and will survive when you destroy the container. I use this to e.g. share a /home directory between a dozen experimental dev container I use to run my various projects - each container ensures I keep track of exact dependencies for each individual project, while I get to have a nice "comfortable" swiss-army-knife container with my dev tools and all all project files.
I also run a number of database containers which use volumes where I bind mount host directories to ensure persistence so I can wipe and rebuild the containers themselves without worrying about touching data.
- wastedhours 12y agoAm intrigued (and, again, showing my current early-stage understanding of LXCs), can you link the same data store container to multiple application containers? As in, have both a beta application and production application pulling data from the same core DB? And do you simply define the container as a volume to ensure it stays persistent? That was the feeling I got from the docs, but again, might just be flagging how little I know at the minute...
- TheDong 12y agodocker run --name=my-data -v /host/data:/container/data data-container docker run --volumes-from=my-data app-beta-container docker run --volumes-from=my-data app-prod-container That would share the data store, however the real way you'd do this would be.... docker run --name=my-data -v /host/data:/container/data data-image docker run --volumes-from my-data --name my-database database-image docker run --link=my-database beta-app docker run --link=my-database prod-app Doing --link will allow those two containers to network-communicate and you should only be communicating with your database over the network anyways.
- shykes 12y agoYes, you can definitely share volumes between any number of containers, it's a common usage pattern. You don't need to make a container persistent: Docker, by design, will never remove anything unless you explicitly ask it to. If you want to separate the lifecycle of a directory within your container, so that it stays behind after you explicitly remove the container, or to share it between containers - that's when volumes are useful.
- pas 12y agoLast time I tried was around 0.8, and aufs was not happy with xfs. I haven't tried having /var/lib/docker on ext4 and "/volumes" on xfs, I'll try if the need arises. I run a few MongoDBs with volumes, but I'm not confident that I won't accidentally start two with the same volume, or that someone won't accidentally delete the volume, or .. or .. or. As I've written to a sibling comment, I don't consider it a hard problem, but it hasn't been taken care of .. yet!