Skip to content

Instantly share code, notes, and snippets.

@inooid
Last active March 23, 2019 16:05
Embed
What would you like to do?
[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