mirror of
https://github.com/clearlinux/docker.git
synced 2026-10-03 15:28:35 +00:00
Merge pull request #12947 from runcom/11577-readonly-special-file-if-readonlyfs
Make /etc/hosts, /etc/resolv.conf, /etc/hostname read only if --read-only enabled
This commit is contained in:
+3
-3
@@ -241,13 +241,13 @@ func validMountMode(mode string) bool {
|
||||
func (container *Container) specialMounts() []execdriver.Mount {
|
||||
var mounts []execdriver.Mount
|
||||
if container.ResolvConfPath != "" {
|
||||
mounts = append(mounts, execdriver.Mount{Source: container.ResolvConfPath, Destination: "/etc/resolv.conf", Writable: true, Private: true})
|
||||
mounts = append(mounts, execdriver.Mount{Source: container.ResolvConfPath, Destination: "/etc/resolv.conf", Writable: !container.hostConfig.ReadonlyRootfs, Private: true})
|
||||
}
|
||||
if container.HostnamePath != "" {
|
||||
mounts = append(mounts, execdriver.Mount{Source: container.HostnamePath, Destination: "/etc/hostname", Writable: true, Private: true})
|
||||
mounts = append(mounts, execdriver.Mount{Source: container.HostnamePath, Destination: "/etc/hostname", Writable: !container.hostConfig.ReadonlyRootfs, Private: true})
|
||||
}
|
||||
if container.HostsPath != "" {
|
||||
mounts = append(mounts, execdriver.Mount{Source: container.HostsPath, Destination: "/etc/hosts", Writable: true, Private: true})
|
||||
mounts = append(mounts, execdriver.Mount{Source: container.HostsPath, Destination: "/etc/hosts", Writable: !container.hostConfig.ReadonlyRootfs, Private: true})
|
||||
}
|
||||
return mounts
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user