Last active
January 18, 2019 21:48
-
-
Save itoonx/4bc291c379bf61c81d7e664bc291d0f2 to your computer and use it in GitHub Desktop.
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 | |
# ------------------------------------ | |
# Clear all container and images | |
alias dkc-clear='docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q) && docker rmi $(docker images -q)' | |
# Stop and Remove all containers | |
alias dkc-all='docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q)' | |
# Stop all container | |
alias dkc-stop-all='docker stop $(docker ps -a -q)' | |
# Start all container | |
alias dkc-start-all='docker start $(docker ps -a -q)' | |
# Remove all images | |
alias dkc-rmi-all='docker rmi $(docker images -q)' | |
# Get latest container ID | |
alias dkc-l="docker ps -l -q" | |
# Get container process | |
alias dkc-p="docker ps" | |
# Get process included stop container | |
alias dkc-pa="docker ps -a" | |
# Get images | |
alias dkc-i="docker images" | |
# Get container IP | |
alias dkc-ip="docker inspect --format '{{ .NetworkSettings.IPAddress }}'" | |
# Run deamonized container, e.g., $dkc-d base /bin/echo hello | |
alias dkc-d="docker run -d -P" | |
# Run interactive container, e.g., $dkc-ri base /bin/bash | |
alias dkc-ri="docker run -i -t -P" | |
# Execute interactive container, e.g., $dkc-exi base /bin/bash | |
alias dkc-exi="docker exec -i -t" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Setup to bash profile
If you are using ~/.bash_profile
content=$(curl https://gist.githubusercontent.com/itoonx/4bc291c379bf61c81d7e664bc291d0f2/raw/ee7aa92760b8e8923101c4d9dc07eee0784a8d7d) | echo $content >> ~/.bash_profile
if you are used another profile like .zshrc follow instruction below
content=$(curl https://gist.githubusercontent.com/itoonx/4bc291c379bf61c81d7e664bc291d0f2/raw/ee7aa92760b8e8923101c4d9dc07eee0784a8d7d) | echo $content >> ~/.zshrc