diff options
author | Matthew Heon <matthew.heon@gmail.com> | 2018-05-01 12:51:04 -0400 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-05-03 12:23:12 +0000 |
commit | 6ebb90f951f5dbfd02fced5902e0adbce68102ba (patch) | |
tree | 6475dd82918f90eb1a3f24ca463a4ac1f471044f /cmd | |
parent | dd569a91f42581156b38583245bec6bf71a5ad21 (diff) | |
download | podman-6ebb90f951f5dbfd02fced5902e0adbce68102ba.tar.gz podman-6ebb90f951f5dbfd02fced5902e0adbce68102ba.tar.bz2 podman-6ebb90f951f5dbfd02fced5902e0adbce68102ba.zip |
When adding volumes to DB, handle nontrivial cases
We want to make sure we don't add anything but the host volume,
and the volumes can include options and container locations.
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
Closes: #700
Approved by: rhatdan
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/podman/spec.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/cmd/podman/spec.go b/cmd/podman/spec.go index e807ab642..7cd21aeba 100644 --- a/cmd/podman/spec.go +++ b/cmd/podman/spec.go @@ -653,7 +653,16 @@ func (c *createConfig) GetContainerCreateOptions() ([]libpod.CtrCreateOption, er } if len(c.Volumes) != 0 { - options = append(options, libpod.WithUserVolumes(c.Volumes)) + // Volumes consist of multiple, comma-delineated fields + // The image spec only includes one part of that, so drop the + // others, if they are included + volumes := make([]string, 0, len(c.Volumes)) + for _, vol := range c.Volumes { + splitVol := strings.Split(vol, ":") + volumes = append(volumes, splitVol[0]) + } + + options = append(options, libpod.WithUserVolumes(volumes)) } if len(c.Command) != 0 { |