Created
December 13, 2022 09:34
-
-
Save k8scat/013aea445781561cbe817a71734cb88a to your computer and use it in GitHub Desktop.
[Docker] Delete volume force
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
volume="" | |
err=$(docker volume rm $volume 2>&1) | |
echo "err: $err" | |
container_ids=$(echo $err | awk -F'[' '{print $2}' | awk -F']' '{print $1}') | |
echo "ids: $ids" | |
IFS=', ' | |
for container_id in $container_ids; do | |
echo "delete container: $container_id" | |
docker rm -f $container_id | |
done | |
docker volume rm $volume |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment