Created
February 10, 2016 09:52
-
-
Save alexbilbie/e9ac80498942b93a3c80 to your computer and use it in GitHub Desktop.
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_ENV="$HOME/.dockerenv" | |
DOCKER_MACHINE_NAME="default" | |
# Docker environment helpers | |
denv() { | |
eval "$(cat $DOCKER_ENV)" | |
} | |
dstart() { | |
docker-machine start $DOCKER_MACHINE_NAME | |
docker-machine env $DOCKER_MACHINE_NAME > $DOCKER_ENV | |
denv | |
} | |
dstop() { | |
docker-machine stop $DOCKER_MACHINE_NAME | |
rm "$HOME/.dockerenv" | |
} | |
# Docker executables | |
dshell() { | |
if [ -z "$@" ]; then | |
echo "An image name must be specified" | |
return 1; | |
fi | |
docker run --rm -it "$@" sh | |
} | |
# Initialize Docker environment if one exists | |
if [[ -f $DOCKER_ENV ]]; then | |
denv | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment