Skip to content

Commit

Permalink
mounts/validate: Don't check source exists with CreateMountpoint
Browse files Browse the repository at this point in the history
Don't error out when mount source doesn't exist and mounts has
`CreateMountpoint` option enabled.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
(cherry picked from commit 6e21f36)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
  • Loading branch information
vvoland committed Feb 22, 2024
1 parent b42cca6 commit 0f78bd8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion volume/mounts/linux_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ func (p *linuxParser) validateMountConfigImpl(mnt *mount.Mount, validateBindSour
if err != nil {
return &errMountConfig{mnt, err}
}
if !exists {

createMountpoint := mnt.BindOptions != nil && mnt.BindOptions.CreateMountpoint
if !exists && !createMountpoint {
return &errMountConfig{mnt, errBindSourceDoesNotExist(mnt.Source)}
}
}
Expand Down

0 comments on commit 0f78bd8

Please sign in to comment.