Created
February 7, 2018 00:36
-
-
Save bradwilson/67bddf8a3e5d45bfe3d4c0c5bab4b954 to your computer and use it in GitHub Desktop.
Docker Cleanup
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
(& docker images --all --quiet --filter 'dangling=true') | Foreach-Object { | |
& docker rmi $_ | out-null | |
} | |
(& docker ps --quiet --filter 'status=exited' ) | Foreach-Object { | |
& docker rm $_ | out-null | |
} |
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
_images=$(docker images --all --quiet --filter 'dangling=true') | |
[[ -z ${_images// } ]] || docker rmi $_images | |
_containers=$(docker ps --quiet --filter 'status=exited') | |
[[ -z ${_containers// } ]] || docker rm $_containers |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment