After reading the docs I found myself somewhat confused as to how best to manage productive application/service data.
There seem to be 3 options:
- Simply map volume to host directory (i.e.
-v
argument fordocker run
) - Create a docker container image for data (i.e. separate container and
--volumes-from
) - Creating a docker volume (i.e.
docker volume create
)
Now, it seems that the accepted practice is option #2, but then I wonder what is the purpose of #3.
Especially how do you correctly handle these scenarios with docker volume
and is it better to use a data volume container or this for each situation?
- You need application data in a separate volume and/or storage tier in your server
- Backing up
- Restoring data
btrfs scrub
on it to find and correct damaged files. I am not sure how dockerized stuff works, but I guess it does not protect against data rot, so I always need a full restore if something bad happens instead of just restoring individual files. Another thought that it adds another layer of abstraction, so it slows down file reading and writing even more. I somehow don't see the advantages of #2 and #3, but I am not experienced with docker, so this might change.