1
0
mirror of https://github.com/frebib/dotfiles.git synced 2024-06-14 12:57:23 +00:00

Improved dsh alias for user specification and added a couple other useful docker aliases

This commit is contained in:
Joe Groocock 2016-08-12 15:54:08 +01:00
parent 13017938ec
commit 7548150a08

15
aliases
View File

@ -125,10 +125,23 @@ alias dbl='docker build'
alias dbl.='docker build .'
alias drun='docker run -ti'
alias dkl='docker kill'
dklrm() { docker kill $1 ; docker rm $1 }
alias dst='docker stop'
alias dlg='docker logs -f'
alias drm-stopped='docker rm -v $(docker ps -a -q -f status=exited)'
alias drmi-untag='docker rmi $(docker images -f "dangling=true" -q)'
dsh() {
docker exec -ti $1 /bin/sh
user=`echo $1 | cut -d'@' -f1 -s`
if [[ -z "$user" ]]; then
host="$1"
usercmd=""
else
host=`echo $1 | cut -d'@' -f2 -s`
usercmd="--user=$user"
fi
echo "docker exec -ti $usercmd $host /bin/sh"
docker exec -ti "$usercmd" "$host" /bin/sh
}
alias dm='docker-machine'