Skip to content

Instantly share code, notes, and snippets.

@didmar
Created April 22, 2016 12:01
Show Gist options
  • Save didmar/1a40c8d7a04d0a2cabdb4a1272d49475 to your computer and use it in GitHub Desktop.
Save didmar/1a40c8d7a04d0a2cabdb4a1272d49475 to your computer and use it in GitHub Desktop.
## Shell command aliases for Docker
dockerip() {
# Get container ip
docker inspect --format '{{ .NetworkSettings.IPAddress }}' $1
}
dockerkillall() {
printf "\n>>> Kill all running containers\n\n" && docker kill $(docker ps -q)
}
dockercleanc() {
printf "\n>>> Deleting stopped containers\n\n" && docker rm $(docker ps -a -q)
}
dockercleani() {
printf "\n>>> Delete untagged images\n\n" && docker rmi $(docker images -q -f dangling=true)
}
dockerclean() {
printf "\n>>> Deleting stopped containers and untagged images\n\n" && dockercleanc || true && dockercleani
}
dockercleanall() {
printf "\n>>> Delete ALL images\n\n" && docker rmi $(docker images -q)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment