Skip to content

[feature] Allow for named volumes to specify host mount point #19990

@CWSpear

Description

@CWSpear

With docker-compose 1.6 coming out soon and the new v2 syntax, I've been learning more about docker volume that came out in docker 1.9.

My thought was that docker volumes could be created to replace data-only containers and --volumes-from. Specifically, it allows for cleaner docker ps and it allows us to mount volumes on two different containers at different places.

But it doesn't let us persist that data as well as data-only containers could.

Is there a particular reason it doesn't/you can't use a mount (or perhaps bind is a better work?) point outside of /var/lib/docker?

My proposal: would it be possible for us to add an option for the local driver to specify a bind/mount point on the host?

My use-case is I use Docker for smaller things that don't need massive scaling, and something like Flocker is mega overkill. However, I have had multiple times where I needed a volume on at least 2 containers and to have it persisted, and it got pretty messy with data-only containers, and it could be solved nicely with my proposal.

Specific use case: I have a letsencrypt docker container that creates certificates. I need the certificates to persist, but I also need my nginx container to have access them. I've had similar setups with images, but I also wanted to have them mounted at different points within the specific containers, something not possible with data-only containers.

I could get some of this working by mounting each container to the same volume on the host, but then my containers are more host-dependent, and I'd rather move that to a dedicated volume whose job it is to persist things, and then I only have one place to change it and my other containers don't need to care about that.

Anyway, hopefully we could add something to help here, please let me know if I can add any clarification, etc. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/volumesVolumeskind/enhancementEnhancements are not bugs or new features but can improve usability or performance.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions