Skip to content

Instantly share code, notes, and snippets.

@sakibian
Forked from F21/cleanup-docker.md
Created January 22, 2023 04:26
Show Gist options
  • Select an option

  • Save sakibian/b704b5965385b469c6a38cbc49abaf03 to your computer and use it in GitHub Desktop.

Select an option

Save sakibian/b704b5965385b469c6a38cbc49abaf03 to your computer and use it in GitHub Desktop.
Commands to clean up docker

Remove dangling images

docker images -qf dangling=true | xargs docker rmi

Remove dangling volumes

docker volume ls -qf dangling=true | xargs -r docker volume rm

Delete exited containers

docker rm `docker ps -aq`

Kill all running containers

docker kill `docker ps -aq`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment