mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #36808 from justincormack/sys-rw-priv-always
Always make sysfs read-write with privileged
This commit is contained in:
commit
fb08a5c6c3
2 changed files with 5 additions and 7 deletions
|
@ -685,14 +685,12 @@ func setMounts(daemon *Daemon, s *specs.Spec, c *container.Container, mounts []c
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.HostConfig.Privileged {
|
if c.HostConfig.Privileged {
|
||||||
if !s.Root.Readonly {
|
|
||||||
// clear readonly for /sys
|
// clear readonly for /sys
|
||||||
for i := range s.Mounts {
|
for i := range s.Mounts {
|
||||||
if s.Mounts[i].Destination == "/sys" {
|
if s.Mounts[i].Destination == "/sys" {
|
||||||
clearReadOnly(&s.Mounts[i])
|
clearReadOnly(&s.Mounts[i])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
s.Linux.ReadonlyPaths = nil
|
s.Linux.ReadonlyPaths = nil
|
||||||
s.Linux.MaskedPaths = nil
|
s.Linux.MaskedPaths = nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -2688,7 +2688,7 @@ func (s *DockerSuite) TestRunContainerWithReadonlyRootfs(c *check.C) {
|
||||||
if root := os.Getenv("DOCKER_REMAP_ROOT"); root != "" {
|
if root := os.Getenv("DOCKER_REMAP_ROOT"); root != "" {
|
||||||
testPriv = false
|
testPriv = false
|
||||||
}
|
}
|
||||||
testReadOnlyFile(c, testPriv, "/file", "/etc/hosts", "/etc/resolv.conf", "/etc/hostname", "/sys/kernel")
|
testReadOnlyFile(c, testPriv, "/file", "/etc/hosts", "/etc/resolv.conf", "/etc/hostname")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestPermissionsPtsReadonlyRootfs(c *check.C) {
|
func (s *DockerSuite) TestPermissionsPtsReadonlyRootfs(c *check.C) {
|
||||||
|
|
Loading…
Reference in a new issue