From 9c23a1507572f56a62e73045ebce7a0db0d9a0ee Mon Sep 17 00:00:00 2001 From: Lyle Franklin Date: Wed, 7 Oct 2015 13:56:40 -0700 Subject: [PATCH 1/2] Source docker-machine environment variables rather than hardcoding Signed-off-by: Frank Kotsianas --- plugins/available/docker-machine.plugin.bash | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/plugins/available/docker-machine.plugin.bash b/plugins/available/docker-machine.plugin.bash index 8c6c146f..20bf0f29 100644 --- a/plugins/available/docker-machine.plugin.bash +++ b/plugins/available/docker-machine.plugin.bash @@ -4,8 +4,5 @@ about-plugin 'Helpers to get Docker setup correctly for docker-machine' # Note, this might need to be different if you use a machine other than 'dev', # or its configured for a different IP if [[ `uname -s` == "Darwin" ]]; then - export DOCKER_HOST="tcp://192.168.99.100:2376" - export DOCKER_CERT_PATH="$HOME/.docker/machine/machines/dev" - export DOCKER_TLS_VERIFY=1 - export DOCKER_MACHINE_NAME="dev" + eval "$(docker-machine env dev)" fi From e704bd72f3cd9ff5b4fcae533cd71b0118eb48ed Mon Sep 17 00:00:00 2001 From: Shash Reddy Date: Thu, 8 Oct 2015 11:11:12 -0700 Subject: [PATCH 2/2] Check whether docker-machine dev is running before configuring env variables Signed-off-by: Lyle Franklin --- plugins/available/docker-machine.plugin.bash | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/available/docker-machine.plugin.bash b/plugins/available/docker-machine.plugin.bash index 20bf0f29..fc2dc44d 100644 --- a/plugins/available/docker-machine.plugin.bash +++ b/plugins/available/docker-machine.plugin.bash @@ -1,8 +1,11 @@ cite about-plugin about-plugin 'Helpers to get Docker setup correctly for docker-machine' -# Note, this might need to be different if you use a machine other than 'dev', -# or its configured for a different IP +# Note, this might need to be different if you use a machine other than 'dev' if [[ `uname -s` == "Darwin" ]]; then - eval "$(docker-machine env dev)" + # check if dev machine is running + docker-machine ls | grep --quiet 'dev.*Running' + if [[ "$?" = "0" ]]; then + eval "$(docker-machine env dev)" + fi fi