diff options
author | Qi Wang <qiwan@redhat.com> | 2020-07-09 15:46:14 -0400 |
---|---|---|
committer | Qi Wang <qiwan@redhat.com> | 2020-07-20 09:48:55 -0400 |
commit | 020d81f113ea1e11398ea77495cc4b8e05a91d38 (patch) | |
tree | f3347aa5b378e215a76e37b2356035e544197da0 /libpod/container_internal_linux.go | |
parent | 17f9b80600bc008e7c0a4060ff3a6bb5eb56d0cc (diff) | |
download | podman-020d81f113ea1e11398ea77495cc4b8e05a91d38.tar.gz podman-020d81f113ea1e11398ea77495cc4b8e05a91d38.tar.bz2 podman-020d81f113ea1e11398ea77495cc4b8e05a91d38.zip |
Add support for overlay volume mounts in podman.
Add support -v for overlay volume mounts in podman.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Signed-off-by: Qi Wang <qiwan@redhat.com>
Diffstat (limited to 'libpod/container_internal_linux.go')
-rw-r--r-- | libpod/container_internal_linux.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go index 255505416..1c21f2ff9 100644 --- a/libpod/container_internal_linux.go +++ b/libpod/container_internal_linux.go @@ -20,6 +20,7 @@ import ( cnitypes "github.com/containernetworking/cni/pkg/types/current" "github.com/containernetworking/plugins/pkg/ns" + "github.com/containers/buildah/pkg/overlay" "github.com/containers/buildah/pkg/secrets" "github.com/containers/common/pkg/apparmor" "github.com/containers/common/pkg/config" @@ -319,6 +320,19 @@ func (c *Container) generateSpec(ctx context.Context) (*spec.Spec, error) { } } + // Add overlay volumes + for _, overlayVol := range c.config.OverlayVolumes { + contentDir, err := overlay.TempDir(c.config.StaticDir, c.RootUID(), c.RootGID()) + if err != nil { + return nil, errors.Wrapf(err, "failed to create TempDir in the %s directory", c.config.StaticDir) + } + overlayMount, err := overlay.Mount(contentDir, overlayVol.Source, overlayVol.Dest, c.RootUID(), c.RootGID(), c.runtime.store.GraphOptions()) + if err != nil { + return nil, errors.Wrapf(err, "creating overlay failed %q", overlayVol.Source) + } + g.AddMount(overlayMount) + } + hasHomeSet := false for _, s := range c.config.Spec.Process.Env { if strings.HasPrefix(s, "HOME=") { @@ -1642,3 +1656,7 @@ func (c *Container) copyTimezoneFile(zonePath string) (string, error) { } return localtimeCopy, err } + +func (c *Container) cleanupOverlayMounts() error { + return overlay.CleanupContent(c.config.StaticDir) +} |