Skip to content

Instantly share code, notes, and snippets.

@amjadbouhouch
Last active January 3, 2022 13:53
Show Gist options
  • Save amjadbouhouch/851b52e33e72713d4b04e073a62c69ab to your computer and use it in GitHub Desktop.
Save amjadbouhouch/851b52e33e72713d4b04e073a62c69ab to your computer and use it in GitHub Desktop.
Docker cleanup commands
#To clear containers
docker rm -f $(docker ps -a -q)
#To clear images:
docker rmi $(docker images -q -f dangling=true)
docker rmi $(docker images -q)
#To clear volumes:
docker volume rm $(docker volume ls -qf dangling=true)
#To clear networks:
docker network rm $(docker network ls | tail -n+2 | awk '{if($2 !~ /bridge|none|host/){ print $1 }}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment