Skip to content

Instantly share code, notes, and snippets.

@inooid
Last active March 23, 2019 16:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save inooid/e0a6152d36676b765535 to your computer and use it in GitHub Desktop.
Save inooid/e0a6152d36676b765535 to your computer and use it in GitHub Desktop.
[Terminal] Docker-machine env shortcut
# 1. Add this to your .bash-profile or .zshrc and restart your terminal
function dm-env () {
if [ -z "$1" ] ; then
echo "\e[0;31mERROR:\e[0m no argument supplied"
return;
fi
eval "$(docker-machine env $1)"
echo -e "\033[33;32mSUCCESS:\e[0m docker-machine environment set to: $1"
}
# Usage:
$ dm-env your-docker-machine-name
# Example:
$ dm-env dev
=> SUCCESS: docker-machine environment set to: dev
# Example without argument:
$ dm-env
=> ERROR: no argument supplied
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment