Skip to content

Instantly share code, notes, and snippets.

@jwalgran
Created April 25, 2018 17:34
Show Gist options
  • Save jwalgran/8a4cb3f6d0ec6624f7a1c15a073cbccb to your computer and use it in GitHub Desktop.
Save jwalgran/8a4cb3f6d0ec6624f7a1c15a073cbccb to your computer and use it in GitHub Desktop.
Commands for cleaning up Docker containers and images

Delete exited containers

 docker container rm $(docker ps --filter "status=exited" | awk '{print $1}' | tail -n +2)

Delete 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