Created
August 9, 2016 08:07
-
-
Save jverdeyen/741d29a8e8d7a8e5d4dd4346fd1bd788 to your computer and use it in GitHub Desktop.
A set of docker aliases
This file contains hidden or 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 and function | |
# ------------------------------------ | |
# Get latest container ID | |
alias dl="docker ps -l -q" | |
# Get container process | |
alias dps="docker ps" | |
# Get process included stop container | |
alias dpa="docker ps -a" | |
# Get images | |
alias di="docker images" | |
# Get container IP | |
alias dip="docker inspect --format '{{ .NetworkSettings.IPAddress }}'" | |
# Run deamonized container, e.g., $dkd base /bin/echo hello | |
alias dkd="docker run -d -P" | |
# Run interactive container, e.g., $dki base /bin/bash | |
alias dki="docker run -i -t -P" | |
alias dc="docker-compose" | |
# Stop all containers | |
dstop() { docker stop $(docker ps -a -q); } | |
# Remove all containers | |
drm() { docker rm $(docker ps -a -q); } | |
# Stop and Remove all containers | |
alias drmf='docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q)' | |
# Remove all images | |
dri() { docker rmi $(docker images -q); } | |
# Dockerfile build, e.g., $dbu tcnksm/test | |
dbu() { docker build -t=$1 .; } | |
# Execute command in Docker Compose service¬ | |
dexec() { docker exec -it `docker-compose ps -q $1` $2; } | |
# Show all alias related docker | |
dalias() { alias | grep 'docker' | sed "s/^\([^=]*\)=\(.*\)/\1 => \2/"| sed "s/['|\']//g" | sort; } | |
alias dps="docker ps -q | xargs docker inspect --format '{{ .Id }} - {{ .Name }} - {{ .NetworkSettings.IPAddress }}'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment