|
|
@@ -719,14 +719,7 @@ MOUNTS:
|
|
|
if m.Type == mount.TypeBind || m.Type == mount.TypeNamedPipe {
|
|
|
for _, v := range service.Volumes {
|
|
|
if v.Target == m.Target && v.Bind != nil && v.Bind.CreateHostPath {
|
|
|
- mode := "rw"
|
|
|
- if m.ReadOnly {
|
|
|
- mode = "ro"
|
|
|
- }
|
|
|
- if v.Bind.SELinux != "" {
|
|
|
- mode += "," + v.Bind.SELinux
|
|
|
- }
|
|
|
- binds = append(binds, fmt.Sprintf("%s:%s:%s", m.Source, m.Target, mode))
|
|
|
+ binds = append(binds, fmt.Sprintf("%s:%s:%s", m.Source, m.Target, getBindMode(v.Bind, m.ReadOnly)))
|
|
|
continue MOUNTS
|
|
|
}
|
|
|
}
|
|
|
@@ -736,6 +729,23 @@ MOUNTS:
|
|
|
return volumeMounts, binds, mounts, nil
|
|
|
}
|
|
|
|
|
|
+func getBindMode(bind *types.ServiceVolumeBind, readOnly bool) string {
|
|
|
+ mode := "rw"
|
|
|
+
|
|
|
+ if readOnly {
|
|
|
+ mode = "ro"
|
|
|
+ }
|
|
|
+
|
|
|
+ switch bind.SELinux {
|
|
|
+ case types.SELinuxShared:
|
|
|
+ mode += ",z"
|
|
|
+ case types.SELinuxPrivate:
|
|
|
+ mode += ",Z"
|
|
|
+ }
|
|
|
+
|
|
|
+ return mode
|
|
|
+}
|
|
|
+
|
|
|
func buildContainerMountOptions(p types.Project, s types.ServiceConfig, img moby.ImageInspect, inherit *moby.Container) ([]mount.Mount, error) {
|
|
|
var mounts = map[string]mount.Mount{}
|
|
|
if inherit != nil {
|