moby/1009-mounts-validate-Don-t-check-source-exists-with-Creat.patch

38 lines
1.3 KiB
Diff
Raw Normal View History

2024-11-29 17:36:30 +08:00
From a72294a6688d747dcfec8751c3e2616cad703a31 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pawe=C5=82=20Gronowski?= <pawel.gronowski@docker.com>
Date: Mon, 19 Feb 2024 15:16:07 +0100
Subject: [PATCH] mounts/validate: Don't check source exists with
CreateMountpoint
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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 05b883bdc836a2fd621452f58a2a2c02d253718c)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
---
volume/mounts/linux_parser.go | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/volume/mounts/linux_parser.go b/volume/mounts/linux_parser.go
index 1b64c23935..e7e8ad80f3 100644
--- a/volume/mounts/linux_parser.go
+++ b/volume/mounts/linux_parser.go
@@ -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)}
}
}
--
2.33.0