Let's say I have a Docker container that holds some data. I want this data to persist - if the container is stopped, removed, upgraded etc. I still want the data to be in an accessible location on the host OS filesystem.
Currently, my solution is to create a directory /srv/service-name
on my host (I use Ubuntu 14.10) and then run my service with the -v /srv/service-name:/path/inside/container
argument.
By trial and error I found out that sometimes the container is unable to write to this, because it doesn't have the right permissions. I found this question where data-only containers are given as a solution. Well, I don't want to use containers because it seems needlessly complicated for what I am doing. I'd rather just keep mounting the directories with -v
.
So, how can I set the right permissions on the directory I am mounting?