mirror of
https://github.com/containers/podman.git
synced 2025-05-22 01:27:07 +08:00
[NO TESTS NEEDED] Create /etc/mtab with the correct ownership
Create the /etc and /etc/mtab directories with the correct ownership based on what the UID and GID is for the container. This was causing issue when starting the infra container with userns as the /etc directory wasn't being created with the correct ownership. Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
This commit is contained in:

committed by
Matthew Heon

parent
6d394f0e47
commit
b957bff8b5
@ -1534,7 +1534,7 @@ func (c *Container) mountStorage() (_ string, deferredErr error) {
|
||||
// If /etc/mtab does not exist in container image, then we need to
|
||||
// create it, so that mount command within the container will work.
|
||||
mtab := filepath.Join(mountPoint, "/etc/mtab")
|
||||
if err := os.MkdirAll(filepath.Dir(mtab), 0755); err != nil {
|
||||
if err := idtools.MkdirAllAs(filepath.Dir(mtab), 0755, c.RootUID(), c.RootGID()); err != nil {
|
||||
return "", errors.Wrap(err, "error creating mtab directory")
|
||||
}
|
||||
if err = os.Symlink("/proc/mounts", mtab); err != nil && !os.IsExist(err) {
|
||||
|
Reference in New Issue
Block a user