Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mount API can't fully replace the legacy Bind API #42332

Open
ndeloof opened this issue Apr 27, 2021 · 0 comments
Open

Mount API can't fully replace the legacy Bind API #42332

ndeloof opened this issue Apr 27, 2021 · 0 comments
Labels
area/api area/volumes kind/enhancement Enhancements are not bugs or new features but can improve usability or performance.

Comments

@ndeloof
Copy link
Contributor

ndeloof commented Apr 27, 2021

Description
docker -v short notation for volume mounts uses the HostConfig.Bind field on ContainerCreate API, and can't be fully translated into --mount flags (Volumes in ContainerCreate API) because the latter does not offer option to create missing host path on bind mount.

The --mount flag exposes many advanced options that can be used to tweak the binding, which are not available with the short -v notation. This prevents user to benefit those advanced features with the same "create if missing" behaviour.

I suggest an additional option is introduce on mount, so that user can get best of both, and tools can adopt the mount API.

Steps to reproduce the issue:

  1. docker run --rm --mount type=bind,src=/does_not_exists,target=/foo,non_recursive=true hello-world
  2. docker run --rm -v /does_not_exists:/foo hello-world

Describe the results you received:

  1. fails with bind source path does not exist
  2. creates host path but volume is created without non_recursive flag set

Describe the results you expected:
I get an option to run 1. and get the source path created on host
or I get an option to run 2. and set the non_recursive flag

Additional information you deem important (e.g. issue happens only occasionally):

see discussion on docker/compose-cli#1563 (comment) as initial reason I had to look into this :P

Output of docker version:

20.10.6

Additional environment details (AWS, VirtualBox, physical, etc.):

@AkihiroSuda AkihiroSuda added area/api area/volumes kind/enhancement Enhancements are not bugs or new features but can improve usability or performance. labels Apr 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/api area/volumes kind/enhancement Enhancements are not bugs or new features but can improve usability or performance.
Projects
None yet
Development

No branches or pull requests

2 participants