From c79d9ca8c1fa698187f8c22818d5ba97a42c52ee Mon Sep 17 00:00:00 2001 From: Adphi Date: Wed, 16 May 2018 10:43:39 +0200 Subject: [PATCH] Added Docker Aliases and Functions --- templates/zshrc.zsh-template | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index 237733db..3ac72856 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -109,3 +109,37 @@ fp() { done } +alias wn="watch -n" +fpath=(~/.zsh/completion $fpath) +autoload -Uz compinit && compinit -i + +alias dc="docker-compose" +alias dm="docker-machine" +alias dmq="eval $(docker-machine env -u)" + +dme() { + eval $(docker-machine env $1) +} + +alias d="docker" +alias cleanContainers="docker container rm \$(docker container ls -a -q) " +alias cleanVolumes="docker volume rm \$(docker volume ls -q) " + +swarmCleanVolumes(){ + nodes=($(docker-machine ls -q)) + + for node in "${nodes[@]}" + do + volumes=($(docker-machine ssh ${node} "docker volume ls -q")) + docker-machine ssh ${node} "docker volume rm ${volumes[@]}" + done +} + +swarmCleanContainers() { + nodes=($(docker-machine ls -q)) + for node in "${nodes[@]}" + do + containers=($(docker-machine ssh ${node} "docker container ls -aq")) + docker-machine ssh ${node} "docker container rm ${containers[@]}" + done +} \ No newline at end of file