diff options
author | umohnani8 <umohnani@redhat.com> | 2018-06-11 15:27:42 -0400 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-07-09 19:30:03 +0000 |
commit | 4855998f1cf533b27e48b2ded5541841fe6a3ea6 (patch) | |
tree | 7bb7e276e04f7d235e667bf088e5c87e43a74924 /libpod/options.go | |
parent | c7424b69911222c2dc92a41308685f1e6d36fb53 (diff) | |
download | podman-4855998f1cf533b27e48b2ded5541841fe6a3ea6.tar.gz podman-4855998f1cf533b27e48b2ded5541841fe6a3ea6.tar.bz2 podman-4855998f1cf533b27e48b2ded5541841fe6a3ea6.zip |
Add --volumes-from flag to podman run and create
podman now supports --volumes-from flag, which allows users
to add all the volumes an existing container has to a new one.
Signed-off-by: umohnani8 <umohnani@redhat.com>
Closes: #931
Approved by: mheon
Diffstat (limited to 'libpod/options.go')
-rw-r--r-- | libpod/options.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libpod/options.go b/libpod/options.go index 9f07db7ed..c02bd4336 100644 --- a/libpod/options.go +++ b/libpod/options.go @@ -885,6 +885,24 @@ func WithUserVolumes(volumes []string) CtrCreateOption { } } +// WithLocalVolumes sets the built-in volumes of the container retrieved +// from a container passed in to the --volumes-from flag. +// This stores the built-in volume information in the ContainerConfig so we can +// add them when creating the container. +func WithLocalVolumes(volumes []string) CtrCreateOption { + return func(ctr *Container) error { + if ctr.valid { + return ErrCtrFinalized + } + + if volumes != nil { + ctr.config.LocalVolumes = append(ctr.config.LocalVolumes, volumes...) + } + + return nil + } +} + // WithEntrypoint sets the entrypoint of the container. // This is not used to change the container's spec, but will instead be used // during commit to populate the entrypoint of the new image. |