mirror of
https://gist.github.com/jgrodziski/9ed4a17709baad10dbcd4530b60dfcbb
synced 2025-12-21 13:23:11 +01:00
This commit is contained in:
committed by
GitHub
parent
4cf7371521
commit
abeac69e13
@@ -8,8 +8,10 @@
|
||||
# wget -O - https://gist.githubusercontent.com/jgrodziski/9ed4a17709baad10dbcd4530b60dfcbb/raw/d84ef1741c59e7ab07fb055a70df1830584c6c18/docker-aliases.sh | bash
|
||||
# #
|
||||
# # Usage: #
|
||||
# dc : docker-compose #
|
||||
# dcu : docker-compose up -d #
|
||||
# dcd : docker-compose down #
|
||||
# dcr : docker-compose run #
|
||||
# dex <container>: execute a bash shell inside the RUNNING <container> #
|
||||
# di <container> : docker inspect <container> #
|
||||
# dim : docker images #
|
||||
@@ -38,12 +40,13 @@ function dip-fn {
|
||||
for DOC in `dnames-fn`
|
||||
do
|
||||
IP=`docker inspect $DOC | grep -m3 IPAddress | cut -d '"' -f 4 | tr -d "\n"`
|
||||
echo $DOC : $IP
|
||||
OUT+=$DOC'\t'$IP'\n'
|
||||
done
|
||||
echo $OUT|column -t
|
||||
}
|
||||
|
||||
function dex-fn {
|
||||
docker exec -it $1 /bin/bash
|
||||
docker exec -it $1 ${2:-bash}
|
||||
}
|
||||
|
||||
function di-fn {
|
||||
@@ -55,15 +58,39 @@ function dl-fn {
|
||||
}
|
||||
|
||||
function drun-fn {
|
||||
docker run -it $1 /bin/bash
|
||||
docker run -it $1 $2
|
||||
}
|
||||
|
||||
function dcr-fn {
|
||||
docker-compose run $@
|
||||
}
|
||||
|
||||
function dsr-fn {
|
||||
docker stop $1;docker rm $1
|
||||
}
|
||||
|
||||
function drmc-fn {
|
||||
docker rm $(docker ps --all -q -f status=exited)
|
||||
}
|
||||
|
||||
function drmid-fn {
|
||||
imgs=$(docker images -q -f dangling=true)
|
||||
[ ! -z "$imgs" ] && docker rmi "$imgs" || echo "no dangling images."
|
||||
}
|
||||
|
||||
# in order to do things like dex $(dlab label) sh
|
||||
function dlab {
|
||||
docker ps --filter="label=$1" --format="{{.ID}}"
|
||||
}
|
||||
|
||||
function dc-fn {
|
||||
docker-compose $*
|
||||
}
|
||||
|
||||
alias dc="dc-fn"
|
||||
alias dcu="docker-compose up -d"
|
||||
alias dcd="docker-compose down"
|
||||
alias dcr=dcr-fn
|
||||
alias dex=dex-fn
|
||||
alias di=di-fn
|
||||
alias dim="docker images"
|
||||
@@ -72,7 +99,7 @@ alias dl=dl-fn
|
||||
alias dnames=dnames-fn
|
||||
alias dps="docker ps"
|
||||
alias dpsa="docker ps -a"
|
||||
alias drmc="docker rm $(docker ps --all -q -f status=exited)"
|
||||
alias drmid="docker rmi $( docker images -q -f dangling=true)"
|
||||
alias drmc=drmc-fn
|
||||
alias drmid=drmid-fn
|
||||
alias drun=drun-fn
|
||||
alias dsr=dsr-fn
|
||||
Reference in New Issue
Block a user