Skip to content

Instantly share code, notes, and snippets.

@k8scat
Created December 13, 2022 09:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save k8scat/013aea445781561cbe817a71734cb88a to your computer and use it in GitHub Desktop.
Save k8scat/013aea445781561cbe817a71734cb88a to your computer and use it in GitHub Desktop.
[Docker] Delete volume force
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