I am experimenting with the new named volumes in docker since 1.9. They are supposed to replace data-only containers. However, I have a hard time to use named volumes for the following use-case:
I have several containers that runs applications as some non-root user, call it appuser; I do fix the uid and gid in my base image from which all the application container images are derived. Each application writes a log file to a folder that is owned by appuser. Then, I set up a data-only container, derived from the same base image. Using the volumes-from directive, I mount this data-only container to store my log files. It works because the uid is fixed.
Instead, If I try to use a named volume, the applications cannot write their log files because the named volume is owned by some user that depends on the volume driver (user xfs in my case of the "local") driver. Is there a possibility to create the log folder with correct permissions in the named volume?
Or put more generally - are named volumes any good if the application in the container that mounts the named volume runs as non-root user? From what I just described above, such an application would not be able to write to or create any folder in the named volume.