Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.