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 05b883b)
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
  • Loading branch information
vvoland authored and AkihiroSuda committed Apr 30, 2024
1 parent ab34280 commit 18e21f8
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 @@ -94,7 +94,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 18e21f8

Please sign in to comment.