Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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