diff options
author | Matthew Heon <matthew.heon@pm.me> | 2019-02-26 12:16:58 -0500 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2019-02-26 12:16:58 -0500 |
commit | 83db80ce172975ddb7c5bfc0d1cea03d5c6b6c94 (patch) | |
tree | 24dc828a104d2c4f4fc10400f4b45be4e7fbf111 /libpod/volume.go | |
parent | 0e252f043707fe4ca556751ee9b23243ce22e3f3 (diff) | |
download | podman-83db80ce172975ddb7c5bfc0d1cea03d5c6b6c94.tar.gz podman-83db80ce172975ddb7c5bfc0d1cea03d5c6b6c94.tar.bz2 podman-83db80ce172975ddb7c5bfc0d1cea03d5c6b6c94.zip |
Only remove image volumes when removing containers
When removing volumes with rm --volumes we want to only remove
volumes that were created with the container. Volumes created
separately via 'podman volume create' should not be removed.
Also ensure that --rm implies volumes will be removed.
Fixes #2441
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'libpod/volume.go')
-rw-r--r-- | libpod/volume.go | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/libpod/volume.go b/libpod/volume.go index 74878b6a4..0c7618841 100644 --- a/libpod/volume.go +++ b/libpod/volume.go @@ -15,11 +15,12 @@ type VolumeConfig struct { // Name of the volume Name string `json:"name"` - Labels map[string]string `json:"labels"` - MountPoint string `json:"mountPoint"` - Driver string `json:"driver"` - Options map[string]string `json:"options"` - Scope string `json:"scope"` + Labels map[string]string `json:"labels"` + MountPoint string `json:"mountPoint"` + Driver string `json:"driver"` + Options map[string]string `json:"options"` + Scope string `json:"scope"` + IsCtrSpecific bool `json:"ctrSpecific"` } // Name retrieves the volume's name @@ -60,3 +61,10 @@ func (v *Volume) Options() map[string]string { func (v *Volume) Scope() string { return v.config.Scope } + +// IsCtrSpecific returns whether this volume was created specifically for a +// given container. Images with this set to true will be removed when the +// container is removed with the Volumes parameter set to true. +func (v *Volume) IsCtrSpecific() bool { + return v.config.IsCtrSpecific +} |