Last active
August 29, 2015 14:16
-
-
Save michaelsbradleyjr/b179ca7e92838d7f08a1 to your computer and use it in GitHub Desktop.
Some helpful docker aliases
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
# GNU parallel | |
# better than xargs: http://www.gnu.org/software/parallel/ | |
# install: (wget -O - pi.dk/3 || curl pi.dk/3/) | bash && \ | |
# echo will cite | parallel --bibtex | |
command -v parallel &>/dev/null | |
if [ $? != 0 ]; then | |
alias para='xargs' | |
else | |
alias para='parallel' | |
fi | |
# docker | |
alias compose='docker-compose' | |
alias ddang="docker images -a -f 'dangling=true'" | |
alias ddangrm="docker images -a -q -f 'dangling=true' | para docker rmi" | |
alias dpsa='docker ps -a' | |
alias dpsarm='docker ps -a -q | para docker kill | para docker rm' | |
alias machine='docker-machine' | |
dmenv () { | |
if [ -n "$1" ]; then | |
$(machine active $1) 2>/dev/null | |
if [ $? != 0 ]; then | |
echo "could not set the active machine: $1" | |
return 1 | |
fi | |
fi | |
local mac= | |
local sta= | |
mac="$(machine active)" | |
sta=$? | |
if [ $sta != 0 ]; then | |
echo "could not get the active machine" | |
return 1 | |
fi | |
local macenv= | |
macenv="$(machine env $mac)" | |
sta=$? | |
if [ $sta != 0 ]; then | |
echo "could not get env settings for active machine: $mac" | |
return 1 | |
fi | |
eval "$macenv" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment