Skip to content

Instantly share code, notes, and snippets.

@Sanix-Darker
Created March 19, 2023 17:43
Show Gist options
  • Save Sanix-Darker/e94058aede7f114fe94dca8cbba5bc2a to your computer and use it in GitHub Desktop.
Save Sanix-Darker/e94058aede7f114fe94dca8cbba5bc2a to your computer and use it in GitHub Desktop.
#!/bin/bash
clean_volumes(){
# List all volumes from docker volume
# then remove the first line
# sed to delete "local " from the /tmp/volumes
# and then apply the docker volume rm on each lines from that file
docker volume ls > /tmp/volumes && \
tail -n +2 /tmp/volumes && \
sed -i 's/local //g' /tmp/volumes && \
while read in; do docker volume rm "$in"; sleep 1; done < /tmp/volumes
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment