Good strategy for storing data using Docker? Good strategy for storing data using Docker? docker docker

Good strategy for storing data using Docker?


Your question is very broad and there is nothing as "best strategy" so to speak. I try my best to guide you to the right direction I hope that helps.

Your question consists of few elements regarding storage, I try to briefly jump to them one by one.

  1. Considering customers data: (by that I'm referring to data that supposed to be stored safely and correctly)

    • Regarding database storages, since you've decided to use BlueMix try to utilise external data stores if possible. All sort of cloud storages from RDBMS to NoSql are available with very good prices.

    • If you want to use you're own database and data stores, you can use host file system mounted into your docker containers and make sure they are setup and backed-up correctly. You can achieve this by simply mounting you volume using -v in Docker.

    • If you want you can also use something called 'Data Containers'. Docker can provide data volumes inside docker containers and they are independent from containers life cycles, and never get garbage collected. So how it works, is that you create a dummy container with a volume using -v but no host path. And then you start another container and use --volumes-from. More info: https://docs.docker.com/engine/userguide/dockervolumes/

    • You can use some external volume plugins to move around you data volumes easily across your fleet and make sure they are available to docker containers when ever needed. I bit more complicated setup but very interesting and fun ;-)Like Flocker: https://clusterhq.com/docker-plugin/ or GlusterFS: https://github.com/calavera/docker-volume-glusterfs and more: https://github.com/docker/docker/blob/master/docs/extend/plugins.md

    • You can also store data into cloud data storages for example Elastic support Amazon S3 for storage snap shots so you can rely on that, to me this does not sound fool proof but it's an option anyway :-)

  2. Next category is data that is generated from your container but it's not actually customers data, like logging information. For those there are couple of options as well:

    • You can again mount a volume from host and store data in your host, back up and send somewhere using logstash for example.

    • You can use various logging plugins and containers that collect data directly from docker daemon, like: loggly or logentries and may more.

    • You can mount syslog /dev/syslog socket directly into you app's container and send data to your host syslog and then collect them using various available mechanisms.

    • If you're using systemd then journald already got all your docker logs and thus application logs if it goes into stdout or stderr you can collect using journalctl and do whatever you want.

These are just the tip of iceberg. If you need more information please let me know, maybe I can help.