Created
June 4, 2020 15:48
-
-
Save meganlkm/465d2dbf815e170b0dffa28856b3dccc to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env bash | |
hash docker &>/dev/null; | |
if [ $? -eq 0 ]; then | |
alias d="docker" | |
function docker-rm-untagged-imgs() { | |
[[ $1 == "force" ]] && OPTS="--force" || OPTS=""; | |
docker images | grep "^<none>" | awk '{print "docker rmi '$OPTS' "$3}' | sh | |
} | |
function docker-rm-stopped() { | |
docker rm $(docker ps -a -q) | |
} | |
function docker-clean() { | |
docker-rm-stopped | |
docker-rm-untagged-imgs | |
} | |
function docker-stop-all() { | |
docker stop $(docker ps -a -q) | |
} | |
function docker-kill-all() { | |
docker kill $(docker ps -q) | |
} | |
function docker-rm-all() { | |
docker rm $(docker ps -a -q) | |
} | |
function docker-rm-all-images() { | |
docker rmi $(docker images -q) | |
} | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment