diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-04-04 11:57:20 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-04 11:57:20 -0700 |
commit | e320efe9ed158f48eefa7046d88f5c842e454f61 (patch) | |
tree | 101a4fbeb7b773143f576263233f3fedb589cfe3 /libpod/container_internal_linux.go | |
parent | 1759eb09e1c13bc8392d515d69ca93226d067c73 (diff) | |
parent | 02c6110093ed23dd637a51611b0bce4fd4ab9ce9 (diff) | |
download | podman-e320efe9ed158f48eefa7046d88f5c842e454f61.tar.gz podman-e320efe9ed158f48eefa7046d88f5c842e454f61.tar.bz2 podman-e320efe9ed158f48eefa7046d88f5c842e454f61.zip |
Merge pull request #2774 from mheon/db_rework_named_volume
Rework named volumes in DB
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 504d6c135..4d6bf61a3 100644 --- a/libpod/container_internal_linux.go +++ b/libpod/container_internal_linux.go @@ -195,6 +195,7 @@ func (c *Container) generateSpec(ctx context.Context) (*spec.Spec, error) { if err := c.makeBindMounts(); err != nil { return nil, err } + // Check if the spec file mounts contain the label Relabel flags z or Z. // If they do, relabel the source directory and then remove the option. for i := range g.Config.Mounts { @@ -218,6 +219,23 @@ func (c *Container) generateSpec(ctx context.Context) (*spec.Spec, error) { g.SetProcessSelinuxLabel(c.ProcessLabel()) g.SetLinuxMountLabel(c.MountLabel()) + + // Add named volumes + for _, namedVol := range c.config.NamedVolumes { + volume, err := c.runtime.GetVolume(namedVol.Name) + if err != nil { + return nil, errors.Wrapf(err, "error retrieving volume %s to add to container %s", namedVol.Name, c.ID()) + } + mountPoint := volume.MountPoint() + volMount := spec.Mount{ + Type: "bind", + Source: mountPoint, + Destination: namedVol.Dest, + Options: namedVol.Options, + } + g.AddMount(volMount) + } + // Add bind mounts to container for dstPath, srcPath := range c.state.BindMounts { newMount := spec.Mount{ |