mirror of
https://github.com/containers/podman.git
synced 2025-06-23 18:59:30 +08:00
container: make resolv.conf and hosts accessible in userns
when running in a new userns, make sure the resolv.conf and hosts files bind mounted from another container are accessible to root in the userns. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
@ -1171,6 +1171,15 @@ func (c *Container) makeBindMounts() error {
|
||||
// finally, save it in the new container
|
||||
c.state.BindMounts["/etc/hosts"] = hostsPath
|
||||
}
|
||||
|
||||
if !hasCurrentUserMapped(c) {
|
||||
if err := makeAccessible(resolvPath, c.RootUID(), c.RootGID()); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := makeAccessible(hostsPath, c.RootUID(), c.RootGID()); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if !c.config.UseImageResolvConf {
|
||||
newResolv, err := c.generateResolvConf()
|
||||
|
Reference in New Issue
Block a user