Skip to content

Instantly share code, notes, and snippets.

@1duo
Last active September 25, 2018 17:48
Show Gist options
  • Select an option

  • Save 1duo/1ad2a8227897d0838f12738c774abe65 to your computer and use it in GitHub Desktop.

Select an option

Save 1duo/1ad2a8227897d0838f12738c774abe65 to your computer and use it in GitHub Desktop.
  • Remove all stopped containers.
docker rm $(docker ps -a -q)
  • Remove all exited containers
docker rm -f $(docker ps -a | grep Exit | awk '{ print $1 }')
  • Remove dangling volumes
docker volume rm $(docker volume ls -q -f dangling=true)
docker volume ls -qf dangling=true | xargs -r docker volume rm
  • Remove all untagged images
docker rmi $(docker images | grep "^<none>" | awk '{print $3}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment