|
@@ -118,7 +118,9 @@ func (container *Container) NetworkMounts() []Mount {
|
|
|
if _, err := os.Stat(container.ResolvConfPath); err != nil {
|
|
|
logrus.Warnf("ResolvConfPath set to %q, but can't stat this filename (err = %v); skipping", container.ResolvConfPath, err)
|
|
|
} else {
|
|
|
- label.Relabel(container.ResolvConfPath, container.MountLabel, shared)
|
|
|
+ if !container.HasMountFor("/etc/resolv.conf") {
|
|
|
+ label.Relabel(container.ResolvConfPath, container.MountLabel, shared)
|
|
|
+ }
|
|
|
writable := !container.HostConfig.ReadonlyRootfs
|
|
|
if m, exists := container.MountPoints["/etc/resolv.conf"]; exists {
|
|
|
writable = m.RW
|
|
@@ -135,7 +137,9 @@ func (container *Container) NetworkMounts() []Mount {
|
|
|
if _, err := os.Stat(container.HostnamePath); err != nil {
|
|
|
logrus.Warnf("HostnamePath set to %q, but can't stat this filename (err = %v); skipping", container.HostnamePath, err)
|
|
|
} else {
|
|
|
- label.Relabel(container.HostnamePath, container.MountLabel, shared)
|
|
|
+ if !container.HasMountFor("/etc/hostname") {
|
|
|
+ label.Relabel(container.HostnamePath, container.MountLabel, shared)
|
|
|
+ }
|
|
|
writable := !container.HostConfig.ReadonlyRootfs
|
|
|
if m, exists := container.MountPoints["/etc/hostname"]; exists {
|
|
|
writable = m.RW
|
|
@@ -152,7 +156,9 @@ func (container *Container) NetworkMounts() []Mount {
|
|
|
if _, err := os.Stat(container.HostsPath); err != nil {
|
|
|
logrus.Warnf("HostsPath set to %q, but can't stat this filename (err = %v); skipping", container.HostsPath, err)
|
|
|
} else {
|
|
|
- label.Relabel(container.HostsPath, container.MountLabel, shared)
|
|
|
+ if !container.HasMountFor("/etc/hosts") {
|
|
|
+ label.Relabel(container.HostsPath, container.MountLabel, shared)
|
|
|
+ }
|
|
|
writable := !container.HostConfig.ReadonlyRootfs
|
|
|
if m, exists := container.MountPoints["/etc/hosts"]; exists {
|
|
|
writable = m.RW
|