mirror of
https://github.com/containers/podman.git
synced 2026-10-20 08:55:09 -04: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:
1 parent
e50e0dad90
commit
9db534e53a
1 file changed
+1
-1
@@ -1535,7 +1535,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