Skip to content

Instantly share code, notes, and snippets.

@crallen
Created March 30, 2020 13:13
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 crallen/1ba9d262202addbb4ed154ebb2ac757e to your computer and use it in GitHub Desktop.
Save crallen/1ba9d262202addbb4ed154ebb2ac757e to your computer and use it in GitHub Desktop.
Script to stop and prune all Docker images
#!/bin/bash
CONTAINERS=$(docker container ls -aq)
if [ -n "$CONTAINERS" ]; then
docker -l debug container stop $CONTAINERS
docker -l debug container rm $CONTAINERS
fi
docker -l debug system prune -af
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment