Created
February 8, 2018 08:20
-
-
Save ilhnctn/920b64a1c8bbb8a99380d80f7949d587 to your computer and use it in GitHub Desktop.
Connect to docer-machine environment from terminal
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
eval_docker_machine(){ | |
MACHINE_NAME = $1 | |
if [[ $# -eq 0 ]] ; then | |
echo "\033[41;37;1m Usage: edm name_of_machine_env !!! \033[0m" | |
exit(1) | |
fi | |
echo "\033[41;37;1m Eval to Docker-machime for $MACHINE_NAME !!! \033[0m" | |
docker-machine ls -t 30 | |
docker-machine env $MACHINE_NAME | |
eval $(docker-machine env $MACHINE_NAME) | |
echo "\033[41;37;1m Following list is from $MACHINE_NAME environment \033[0m" | |
docker ps | |
} | |
alias edm="eval_docker_machine" | |
# Add to your bash | |
# source the bashfile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment