Skip to content

Instantly share code, notes, and snippets.

@mchoplin
Last active December 12, 2018 10:54
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 mchoplin/2f25220625963db3b1e5eb78da8623cd to your computer and use it in GitHub Desktop.
Save mchoplin/2f25220625963db3b1e5eb78da8623cd to your computer and use it in GitHub Desktop.
remove_docker_containers_and_images.sh
#!/bin/bash
# Stop all docker containers
docker container stop $(docker container ls -a -q)
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
# Remove the volumes (--volumes), any unused images (--all), as well as override the confirmation prompt (--force)
docker system prune -a -f --volumes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment