Last active
January 9, 2016 08:15
-
-
Save skatsuta/bcfe85a3550f6e3f8e2f to your computer and use it in GitHub Desktop.
.envrc for setting environment variables of Docker Machine
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
local machine=dev | |
local state=`docker-machine ls | grep $machine | awk '{ print $4 }'` | |
# Start machine if not running | |
if [[ "$state" != "Running" ]]; then | |
echo "Machine \"$machine\" is not running. Starting..." | |
docker-machine start $machine | |
docker-compose up -d | |
fi | |
# Set env vars for the machine | |
if [[ $DOCKER_MACHINE_NAME != $machine ]]; then | |
eval "`docker-machine env $machine`" | |
fi | |
export DOCKER_IP=`docker-machine ip $machine` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment