Skip to content

Instantly share code, notes, and snippets.

@DavMorr
Last active February 13, 2018 20:50
Show Gist options
  • Save DavMorr/e460fb5644f5010a5fe2764daec4e81d to your computer and use it in GitHub Desktop.
Save DavMorr/e460fb5644f5010a5fe2764daec4e81d to your computer and use it in GitHub Desktop.
Compiled from gist thread: https://gist.github.com/evanscottgray/8571828
##CONTAINERS
stop all containers:
docker stop $(docker ps -a -q)
--prefereable
docker kill $(docker ps -q)
--brute force
remove all containers
docker rm $(docker ps -a -q)
##IMAGES
remove all docker images
docker rmi $(docker images -q)
##VOLUMES
remove all docker volumes
docker volume ls -qf dangling=true | xargs -r docker volume rm
##EVERYTHING UNUSED
docker system prune [OPTIONS]
--https://docs.docker.com/engine/reference/commandline/system_prune/#parent-command
--"This is the preferred way. Removes all non-running volumes / images / networks and everything else."
docker ps -q | xargs -r docker stop ; docker system purge -a
##ALSO SEE
https://github.com/ZZROTDesign/docker-clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment