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}')