From 7500c656476fbdde3930197b323ddc96423c3406 Mon Sep 17 00:00:00 2001 From: Sebastian <379651+czarly@users.noreply.github.com> Date: Sun, 17 Mar 2024 04:36:48 +0100 Subject: [PATCH] another neat script --- delete-volumes.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 delete-volumes.sh diff --git a/delete-volumes.sh b/delete-volumes.sh new file mode 100755 index 00000000..13657eba --- /dev/null +++ b/delete-volumes.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Read the JSON input and extract the list of keys +keys=$(cat /root/rpc/$1.yml | yaml2json - | jq '.volumes' | jq -r 'keys[]') + +# Iterate over the list of keys +for key in $keys; do + echo "removing: /var/lib/docker/volumes/rpc_$key" + + docker volume rm "rpc_$key" + +done