From 7580c227348af2a0906a692ad6a44348dc3eefbc Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Mon, 11 Oct 2021 15:02:04 -0400 Subject: Remove a volume with --force if container is running Currently we are not passing the force flag down to the removal of the running container. If the container is running, and we set --force when removing the volume, the container should be stopped. Signed-off-by: Daniel J Walsh --- libpod/runtime_volume_linux.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'libpod') diff --git a/libpod/runtime_volume_linux.go b/libpod/runtime_volume_linux.go index b08693529..ed3cc971c 100644 --- a/libpod/runtime_volume_linux.go +++ b/libpod/runtime_volume_linux.go @@ -230,11 +230,7 @@ func (r *Runtime) removeVolume(ctx context.Context, v *Volume, force bool, timeo logrus.Debugf("Removing container %s (depends on volume %q)", ctr.ID(), v.Name()) - // TODO: do we want to set force here when removing - // containers? - // I'm inclined to say no, in case someone accidentally - // wipes a container they're using... - if err := r.removeContainer(ctx, ctr, false, false, false, timeout); err != nil { + if err := r.removeContainer(ctx, ctr, force, false, false, timeout); err != nil { return errors.Wrapf(err, "error removing container %s that depends on volume %s", ctr.ID(), v.Name()) } } -- cgit v1.2.3-54-g00ecf