feat: Add script to delete Docker volumes by keyword

This commit is contained in:
Christopher
2024-05-04 14:20:35 -05:00
parent c3a0c2e6ed
commit f3eeade4bf
2 changed files with 22 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
# Run command
```bash
bash -c "$(wget -qLO - https://raw.githubusercontent.com/bigbeartechworld/big-bear-scripts/master/delete-docker-volumes-by-keyword/run.sh)"
```

View File

@@ -0,0 +1,17 @@
#!/bin/bash
# List all Docker volumes
echo "Here are all the available Docker volumes:"
docker volume ls --format '{{.Name}}'
# Provide a blank line for better readability
echo ""
# Prompt the user to enter a word associated with the volumes they want to remove
echo "Enter the keyword associated with the Docker volumes you want to remove:"
read word
# Use the word to filter and remove Docker volumes
docker volume ls --format '{{.Name}}' | grep "$word" | awk '{print $1}' | xargs -r docker volume rm
echo "Volumes associated with '$word' have been removed."