use 'force' on all docker related removals

This commit is contained in:
Asif Bacchus 2020-03-14 17:44:20 -06:00
parent 1108797ac2
commit 17dda2504d

View File

@ -243,7 +243,7 @@ if [ $clean = true ]; then
volumes=$(docker inspect --format '{{ range .Mounts }}{{ println .Name }}{{ end }}' ${container})
# remove container
printf "\t%sRemoving container...%s\n" "$red" "$norm"
docker rm ${container} > /dev/null 2>&1
docker rm -f ${container} > /dev/null 2>&1
# pause to allow write flushing
sleep 3
# iterate volumes
@ -251,7 +251,7 @@ if [ $clean = true ]; then
shift
for volume; do
printf "\t%sRemoving volume '%s'...%s\n" "$red" "$volume" "$norm"
docker volume rm ${volume} > /dev/null 2>&1
docker volume rm -f ${volume} > /dev/null 2>&1
done
printf "%s...done%s\n" "$cyan" "$norm"
done
@ -265,8 +265,8 @@ elif [ $restore = true ]; then
prompt_yn
# delete any conflicting volumes
docker volume rm ${volume_data} > /dev/null 2>&1
docker volume rm ${volume_ldif} > /dev/null 2>&1
docker volume rm -f ${volume_data} > /dev/null 2>&1
docker volume rm -f ${volume_ldif} > /dev/null 2>&1
# run temporary container to merge backup data into volumes
docker run --rm \
-v "$volume_data":/var/openldap/data \