diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-05-17 15:35:20 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-17 15:35:20 -0400 |
commit | f65d9309cbe8ccbacb64fc720d99d78c14ef4139 (patch) | |
tree | 7a933ec9abfab6f7dd7dec61dd6c7550f4c0451b /libpod/container_internal.go | |
parent | 0a3444613e5eed3322d2b44cdc94a5ab9678768b (diff) | |
parent | b75bb4665e1c4db2bb3b931af04c099deec0f666 (diff) | |
download | podman-f65d9309cbe8ccbacb64fc720d99d78c14ef4139.tar.gz podman-f65d9309cbe8ccbacb64fc720d99d78c14ef4139.tar.bz2 podman-f65d9309cbe8ccbacb64fc720d99d78c14ef4139.zip |
Merge pull request #10270 from rhatdan/mtab
Create the /etc/mtab file if does not exists
Diffstat (limited to 'libpod/container_internal.go')
-rw-r--r-- | libpod/container_internal.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go index 53b85a466..9af652409 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -1530,6 +1530,16 @@ 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 { + return "", errors.Wrap(err, "error creating mtab directory") + } + if err = os.Symlink("/proc/mounts", mtab); err != nil && !os.IsExist(err) { + return "", err + } + // Request a mount of all named volumes for _, v := range c.config.NamedVolumes { vol, err := c.mountNamedVolume(v, mountPoint) |