Windows: Support RO volumes 14350+

Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 8d174a43babd19e8c1166338b5aa5f1128914a96
Component: engine
This commit is contained in:
John Howard
2016-06-07 14:55:36 -07:00
parent 5a1641d4f8
commit 9ca189a13d
3 changed files with 60 additions and 34 deletions
+17 -10
View File
@@ -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.