-
Notifications
You must be signed in to change notification settings - Fork 18.9k
enhancement: ability to specify file v folder mount #16302
Copy link
Copy link
Closed
Labels
exp/intermediatekind/featureFunctionality or other elements that the project doesn't currently have. Features are new and shinyFunctionality or other elements that the project doesn't currently have. Features are new and shiny
Description
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
exp/intermediatekind/featureFunctionality or other elements that the project doesn't currently have. Features are new and shinyFunctionality or other elements that the project doesn't currently have. Features are new and shiny