Skip to content

enhancement: ability to specify file v folder mount #16302

@tony-kerz

Description

@tony-kerz

i have ran into problems in the past attempting to mount a file that is accidentally not present.

docker will assume that i want to mount a folder and it will create a folder (named after the missing file) creating confusion.

for example:

docker run -v /path/to/file.txt:/file.txt me/my-image

will create a folder named file.txt at /path/to if /path/to/file.txt doesn't exist.

i burned a few hours on this once with a docker-ized node app that was complaining that i was trying to open a folder as a file.

i thought it might be smoother if i could signal to docker that i am going after a file v a folder, and then if i specify :ro have it throw an error if it doesn't exist, or if it is :rw (default) have it just create the file.

so something like a -f option to indicate mounting a file, like so:

docker run -f /path/to/file.txt:/file.txt me/my-image

Metadata

Metadata

Assignees

No one assigned

    Labels

    exp/intermediatekind/featureFunctionality or other elements that the project doesn't currently have. Features are new and shiny

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions