|
@@ -1161,8 +1161,12 @@ func (container *Container) CleanupStorage() error {
|
|
|
|
|
|
func (container *Container) networkMounts() []execdriver.Mount {
|
|
func (container *Container) networkMounts() []execdriver.Mount {
|
|
var mounts []execdriver.Mount
|
|
var mounts []execdriver.Mount
|
|
|
|
+ mode := "Z"
|
|
|
|
+ if container.hostConfig.NetworkMode.IsContainer() {
|
|
|
|
+ mode = "z"
|
|
|
|
+ }
|
|
if container.ResolvConfPath != "" {
|
|
if container.ResolvConfPath != "" {
|
|
- label.SetFileLabel(container.ResolvConfPath, container.MountLabel)
|
|
|
|
|
|
+ label.Relabel(container.ResolvConfPath, container.MountLabel, mode)
|
|
mounts = append(mounts, execdriver.Mount{
|
|
mounts = append(mounts, execdriver.Mount{
|
|
Source: container.ResolvConfPath,
|
|
Source: container.ResolvConfPath,
|
|
Destination: "/etc/resolv.conf",
|
|
Destination: "/etc/resolv.conf",
|
|
@@ -1171,7 +1175,7 @@ func (container *Container) networkMounts() []execdriver.Mount {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
if container.HostnamePath != "" {
|
|
if container.HostnamePath != "" {
|
|
- label.SetFileLabel(container.HostnamePath, container.MountLabel)
|
|
|
|
|
|
+ label.Relabel(container.HostnamePath, container.MountLabel, mode)
|
|
mounts = append(mounts, execdriver.Mount{
|
|
mounts = append(mounts, execdriver.Mount{
|
|
Source: container.HostnamePath,
|
|
Source: container.HostnamePath,
|
|
Destination: "/etc/hostname",
|
|
Destination: "/etc/hostname",
|
|
@@ -1180,7 +1184,7 @@ func (container *Container) networkMounts() []execdriver.Mount {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
if container.HostsPath != "" {
|
|
if container.HostsPath != "" {
|
|
- label.SetFileLabel(container.HostsPath, container.MountLabel)
|
|
|
|
|
|
+ label.Relabel(container.HostsPath, container.MountLabel, mode)
|
|
mounts = append(mounts, execdriver.Mount{
|
|
mounts = append(mounts, execdriver.Mount{
|
|
Source: container.HostsPath,
|
|
Source: container.HostsPath,
|
|
Destination: "/etc/hosts",
|
|
Destination: "/etc/hosts",
|