diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-07-20 14:11:17 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-20 14:11:17 -0400 |
commit | 0d26a573e3cf8cc5baea84206a86cb83b433b6d5 (patch) | |
tree | fc86e361ff0fd566310262399fec67f94da6514a /libpod/options.go | |
parent | e8de509be5b6ff65088a204a5bb5fd32987f561d (diff) | |
parent | 020d81f113ea1e11398ea77495cc4b8e05a91d38 (diff) | |
download | podman-0d26a573e3cf8cc5baea84206a86cb83b433b6d5.tar.gz podman-0d26a573e3cf8cc5baea84206a86cb83b433b6d5.tar.bz2 podman-0d26a573e3cf8cc5baea84206a86cb83b433b6d5.zip |
Merge pull request #6895 from QiWang19/pr-3457
Add support for overlay volume mounts in podman.
Diffstat (limited to 'libpod/options.go')
-rw-r--r-- | libpod/options.go | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/libpod/options.go b/libpod/options.go index 32748a3c1..40cf452db 100644 --- a/libpod/options.go +++ b/libpod/options.go @@ -1380,17 +1380,7 @@ func WithNamedVolumes(volumes []*ContainerNamedVolume) CtrCreateOption { return define.ErrCtrFinalized } - destinations := make(map[string]bool) - for _, vol := range volumes { - // Don't check if they already exist. - // If they don't we will automatically create them. - - if _, ok := destinations[vol.Dest]; ok { - return errors.Wrapf(define.ErrInvalidArg, "two volumes found with destination %s", vol.Dest) - } - destinations[vol.Dest] = true - mountOpts, err := util.ProcessOptions(vol.Options, false, "") if err != nil { return errors.Wrapf(err, "error processing options for named volume %q mounted at %q", vol.Name, vol.Dest) @@ -1407,6 +1397,25 @@ func WithNamedVolumes(volumes []*ContainerNamedVolume) CtrCreateOption { } } +// WithOverlayVolumes adds the given overlay volumes to the container. +func WithOverlayVolumes(volumes []*ContainerOverlayVolume) CtrCreateOption { + return func(ctr *Container) error { + if ctr.valid { + return define.ErrCtrFinalized + } + + for _, vol := range volumes { + + ctr.config.OverlayVolumes = append(ctr.config.OverlayVolumes, &ContainerOverlayVolume{ + Dest: vol.Dest, + Source: vol.Source, + }) + } + + return nil + } +} + // WithHealthCheck adds the healthcheck to the container config func WithHealthCheck(healthCheck *manifest.Schema2HealthConfig) CtrCreateOption { return func(ctr *Container) error { |