mirror of
https://github.com/docker/cli.git
synced 2026-09-28 02:06:53 -04:00
Windows: Support RO volumes 14350+
Signed-off-by: John Howard <jhoward@microsoft.com> Upstream-commit: 8d174a43babd19e8c1166338b5aa5f1128914a96 Component: engine
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/pkg/system"
|
||||
)
|
||||
|
||||
// read-write modes
|
||||
@@ -68,18 +69,24 @@ const (
|
||||
// - Variation on hostdir but can be a drive followed by colon as well
|
||||
// - If a path, must be absolute. Can include spaces
|
||||
// - Drive cannot be c: (explicitly checked in code, not RegEx)
|
||||
//
|
||||
|
||||
// RXMode is the regex expression for the mode of the mount
|
||||
RXMode = `(:(?P<mode>(?i)rw))?`
|
||||
// Temporarily for TP4, disabling the use of ro as it's not supported yet
|
||||
// in the platform. TODO Windows: `(:(?P<mode>(?i)ro|rw))?`
|
||||
// mode (optional)
|
||||
// - Hopefully self explanatory in comparison to above.
|
||||
// - Colon is not in the capture group
|
||||
//
|
||||
)
|
||||
|
||||
// RXMode is the regex expression for the mode of the mount
|
||||
var RXMode string
|
||||
|
||||
func init() {
|
||||
osv := system.GetOSVersion()
|
||||
// Read-only volumes supported from 14350 onwards (post Windows Server 2016 TP5)
|
||||
// Mode (optional):
|
||||
// - Hopefully self explanatory in comparison to above regex's.
|
||||
// - Colon is not in the capture group
|
||||
if osv.Build >= 14350 {
|
||||
RXMode = `(:(?P<mode>(?i)ro|rw))?`
|
||||
} else {
|
||||
RXMode = `(:(?P<mode>(?i)rw))?`
|
||||
}
|
||||
}
|
||||
|
||||
// BackwardsCompatible decides whether this mount point can be
|
||||
// used in old versions of Docker or not.
|
||||
// Windows volumes are never backwards compatible.
|
||||
|
||||
Reference in New Issue
Block a user