Skip to content

Instantly share code, notes, and snippets.

@dieunb
Created November 4, 2017 14:36
Show Gist options
  • Select an option

  • Save dieunb/e1ec16970b1ae34758387c0de1418ea2 to your computer and use it in GitHub Desktop.

Select an option

Save dieunb/e1ec16970b1ae34758387c0de1418ea2 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