Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

when bind mount has CreateHostPath set, use bind API#1604

Merged
ndeloof merged 1 commit intodocker-archive:mainfrom
ndeloof:bind_volume
Apr 28, 2021
Merged

when bind mount has CreateHostPath set, use bind API#1604
ndeloof merged 1 commit intodocker-archive:mainfrom
ndeloof:bind_volume

Conversation

@ndeloof
Copy link
Copy Markdown
Collaborator

@ndeloof ndeloof commented Apr 27, 2021

What I did

Use bind when volume definition require host path to be created when missing, which isn't supported by mount

Closes #1543
Supersede #1563
https://docker.atlassian.net/browse/IL-79

@github-actions github-actions Bot added the local Local context (moby) label Apr 27, 2021
@ndeloof ndeloof force-pushed the bind_volume branch 3 times, most recently from 45c0552 to 393e5aa Compare April 27, 2021 14:49
@ndeloof ndeloof requested a review from gtardif April 28, 2021 07:48
@ndeloof ndeloof marked this pull request as ready for review April 28, 2021 07:48
Comment thread local/compose/create.go
binds = append(binds, fmt.Sprintf("%s:%s:rw", m.Source, m.Target))
volumeMounts[m.Target] = struct{}{}
// `Bind` API is used when host path need to be created if missing, `Mount` is preferred otherwise
if m.Type == mount.TypeBind {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To confirm: so we keep "bind" mounts only in the case of "createHostPath == true", otherwise default to the mount API even when m.Type == mount.TypeBind, is this correct ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes indeed, which will only happen if user did define an explicit mount with full syntax,
... which is probably less than 1% usages, everybody just uses source:target short syntax

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

local Local context (moby)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

invalid mount config for type "bind": bind source path does not exist:

2 participants