Skip to content

Instantly share code, notes, and snippets.

@hx-natthawat
Forked from fredeerock/docker_cleanup.md
Created May 2, 2020 15:10
Show Gist options
  • Select an option

  • Save hx-natthawat/60e8a8e8f5eabcfa542483b1c423cede to your computer and use it in GitHub Desktop.

Select an option

Save hx-natthawat/60e8a8e8f5eabcfa542483b1c423cede to your computer and use it in GitHub Desktop.
clean up docker

Stop all containers:

  • docker ps -aq | xargs docker stop

Remove all containers:

  • docker ps -aq | xargs docker rm

Remove all images:

  • docker images -aq | xargs docker rmi

Remove all networks:

  • docker network ls -q | xargs docker network rm

Remove all volumes:

  • docker volume ls -q | xargs docker volume rm

Remove all stopped containers, unused networks, dangling images, and build cache:

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