Added volume bind option SELinux label :z :Z

Added unsupported volume bind option SELinux label `:z` and `:Z` in v2.

It is a regression compared to v1 written in Python.

The v2 uses the compose-spec/compose-go to parse Compose YAML
specification files but there was missing support for volume bind option
SELinux label `:z` and `:Z` in parser. It is fixed in:

- https://github.com/compose-spec/compose-go/pull/213

It fixes #9072

References:

- https://docs.docker.com/storage/bind-mounts/#configure-the-selinux-label

Signed-off-by: Tymoteusz Blazejczyk <tymoteusz.blazejczyk@tymonx.com>
This commit is contained in:
Tymoteusz Blazejczyk 2022-01-01 16:16:14 +01:00 committed by Nicolas De loof
parent 381df20010
commit faaa93bf12
3 changed files with 7 additions and 3 deletions

View file

@ -723,6 +723,9 @@ MOUNTS:
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))
continue MOUNTS
}