Skip to content

Instantly share code, notes, and snippets.

@falmar
Forked from kuznero/docker-clean.md
Created October 27, 2017 20:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save falmar/ea4dd1d1e552a83d0e086039e7f6ac9a to your computer and use it in GitHub Desktop.
Save falmar/ea4dd1d1e552a83d0e086039e7f6ac9a to your computer and use it in GitHub Desktop.
Cleanup docker images and containers after failed builds

Cleanup docker images and containers after failed builds

Sometimes, there are some untagged images left behind after failed builds. In order to get rid of those, this script can be used.

#!/bin/bash
docker rm $(docker ps -aq)
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