Created
June 25, 2016 01:01
-
-
Save arthuralvim/0a59e832a96bdb78e5f765dca3334eb0 to your computer and use it in GitHub Desktop.
Docker aliases and functions to work at zsh.
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
# docker | |
alias doco='docker-compose' | |
alias doma='docker-machine' | |
alias doenv='printenv | grep DOCKER' | |
alias doim='docker images' | |
alias dorm='docker rm' | |
alias dohosts='doma ls --format "{{.Name}} {{.Active}}"' | |
alias domals='doma ls' | |
alias dormi='docker rmi' | |
alias dormia='dormi $(doim -q)' | |
alias dops='docker ps' | |
alias dopsa='docker ps -a' | |
alias dopsq='docker ps -q' | |
alias dopsaq='docker ps -aq' | |
alias dorm-stopped='dorm $(dopsaq)' | |
alias dorm-exited='dorm $(dopsq -f status=exited)' | |
alias dormi-untagged='dormi $(doim -q -f dangling=true)' | |
alias docker-clean='dorm-stopped || true && dormi-untagged' | |
function dockeron { | |
if [ ! "$DOCKER_MACHINE_NAME" = "" ]; then | |
echo "$DOCKER_MACHINE_NAME is activated!" | |
return 1 | |
fi | |
if [ -z "$1" ]; then | |
echo "Docker host name is required! docker-machine " | |
else | |
eval "$(docker-machine env "${1:-default}")" | |
fi | |
} | |
function dockeroff () { | |
if [ "$DOCKER_MACHINE_NAME" = "" ]; then | |
printf "No machine running..\n" | |
return 1 | |
else | |
eval "$(docker-machine env -u)" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment