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:
parent
13017938ec
commit
7548150a08
15
aliases
15
aliases
@ -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'
|
||||
|
Loading…
Reference in New Issue
Block a user