Skip to content

Instantly share code, notes, and snippets.

@jesugmz
Last active May 20, 2020 19:48
Show Gist options
  • Save jesugmz/170dae1804474490ecc28a4925af1042 to your computer and use it in GitHub Desktop.
Save jesugmz/170dae1804474490ecc28a4925af1042 to your computer and use it in GitHub Desktop.
Delete the whole Docker data created by the user. TAKE CARE!!!
#!/bin/bash
#
# Delete the whole data created by the user. TAKE CARE!!!
#
# kill all running containers
docker kill $(docker ps -q)
# delete all containers
docker rm $(docker ps -aq)
# delete all images
docker rmi $(docker images -q)
# delete all volumes
docker volume rm $(docker volume ls -qf dangling=true)
# delete all networks
docker network rm $(docker network ls -q)
@jesugmz
Copy link
Author

jesugmz commented Aug 19, 2018

To just clean unnecesary data run docker system prune.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment