From 90271980fd5def93f6792db35dcd99352bfb72e5 Mon Sep 17 00:00:00 2001 From: Nils Winkler Date: Thu, 16 Jul 2015 13:10:38 +0200 Subject: [PATCH] Moved boot2docker functionality to its own file. Also added a docker-machine plugin, which sets the same variables for docker-machine. --- plugins/available/boot2docker.bash | 15 +++++++++++++++ plugins/available/docker-machine.bash | 11 +++++++++++ plugins/available/docker.plugin.bash | 15 +-------------- 3 files changed, 27 insertions(+), 14 deletions(-) create mode 100644 plugins/available/boot2docker.bash create mode 100644 plugins/available/docker-machine.bash diff --git a/plugins/available/boot2docker.bash b/plugins/available/boot2docker.bash new file mode 100644 index 00000000..1bfabfcc --- /dev/null +++ b/plugins/available/boot2docker.bash @@ -0,0 +1,15 @@ +cite about-plugin +about-plugin 'Helpers to get Docker setup correctly for boot2docker' + +# Note, this might need to be different if you have an older version +# of boot2docker, or its configured for a different IP +if [[ `uname -s` == "Darwin" ]]; then + export DOCKER_HOST="tcp://192.168.59.103:2376" + export DOCKER_CERT_PATH="~/.boot2docker/certs/boot2docker-vm" + export DOCKER_TLS_VERIFY=1 + + docker-enter() { + boot2docker ssh '[ -f /var/lib/boot2docker/nsenter ] || docker run --rm -v /var/lib/boot2docker/:/target jpetazzo/nsenter' + boot2docker ssh -t sudo "/var/lib/boot2docker/docker-enter \"$1\"" + } +fi diff --git a/plugins/available/docker-machine.bash b/plugins/available/docker-machine.bash new file mode 100644 index 00000000..18bf8ace --- /dev/null +++ b/plugins/available/docker-machine.bash @@ -0,0 +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 +if [[ `uname -s` == "Darwin" ]]; then + export DOCKER_HOST="tcp://192.168.99.100:2376" + export DOCKER_CERT_PATH="~/.docker/machine/machines/dev" + export DOCKER_TLS_VERIFY=1 + export DOCKER_MACHINE_NAME="dev" +fi diff --git a/plugins/available/docker.plugin.bash b/plugins/available/docker.plugin.bash index 0b4497f2..ac7d07d7 100644 --- a/plugins/available/docker.plugin.bash +++ b/plugins/available/docker.plugin.bash @@ -1,18 +1,5 @@ cite about-plugin -about-plugin 'Helpers to get Docker setup correctly for boot2docker and to more easily work with Docker' - -# Note, this might need to be different if you have an older version -# of boot2docker, or its configured for a different IP -if [[ `uname -s` == "Darwin" ]]; then - export DOCKER_HOST=tcp://192.168.59.103:2376 - export DOCKER_CERT_PATH=~/.boot2docker/certs/boot2docker-vm - export DOCKER_TLS_VERIFY=1 - - docker-enter() { - boot2docker ssh '[ -f /var/lib/boot2docker/nsenter ] || docker run --rm -v /var/lib/boot2docker/:/target jpetazzo/nsenter' - boot2docker ssh -t sudo "/var/lib/boot2docker/docker-enter \"$1\"" - } -fi +about-plugin 'Helpers to more easily work with Docker' function docker-remove-most-recent-container() { about 'attempt to remove the most recent container from docker ps -a'