-
-
Save aabeben/39655006529db38e9af5c22fd7cb6c3b to your computer and use it in GitHub Desktop.
Some useful shell aliases and function for Docker command line
This file contains 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 aliases | |
alias di='sudo docker images' | |
alias dps='sudo docker ps -a' | |
# useful Docker functions | |
dock-run() { sudo docker run -i -t --privileged $@ ;} | |
dock-exec() { sudo docker exec -i -t $@ /bin/bash ;} | |
dock-log() { sudo docker logs --tail=all -f $@ ;} | |
dock-port() { sudo docker port $@ ;} | |
dock-vol() { sudo docker inspect --format '{{ .Volumes }}' $@ ;} | |
dock-ip() { sudo docker inspect --format '{{ .NetworkSettings.IPAddress }}' $@ ;} | |
dock-rmc() { sudo docker rm `sudo docker ps -qa --filter 'status=exited'` ;} | |
dock-rmi() { sudo docker rmi -f `sudo docker images | grep '^<none>' | awk '{print $3}'` ;} | |
dock-do() { | |
if [ "$#" -ne 1 ]; then | |
echo "Usage: $0 start|stop|pause|unpause|<any valid docker cmd>" | |
fi | |
for c in $(sudo docker ps -a | awk '{print $1}' | sed "1 d") | |
do | |
sudo docker $1 $c | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment