Created
July 2, 2018 08:45
-
-
Save ljay79/493712bf5d372631e8b91c56756859a8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# | |
# General docker cleanup. Handy if you've been ahcking and need the | |
# accumulated juk to be blown away. Use at your own risk. | |
# | |
# First, remove the non-running containers. | |
# docker rm $(docker ps -aq -f "status=exited") | |
TAINERS=`docker ps -aq -f "status=exited" -f "status=dead"` | |
if test x"$TAINERS" != x; then | |
echo -n 'Removing exited containers...' | |
docker rm $TAINERS | |
fi | |
# Next, remove failed images. | |
# docker rmi $(docker images -q -f "dangling=true") | |
MAGES=`docker images -q -f "dangling=true"` | |
if test x"$MAGES" != x; then | |
echo -n 'Removing dangling images' | |
docker rmi $MAGES | |
fi | |
# docker rmi $(docker images --filter dangling=true) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment