From cf7681c8087b24d96c3e5c41daeeeb9e52987128 Mon Sep 17 00:00:00 2001 From: Matt Burke Date: Tue, 20 Jan 2015 10:05:45 -0500 Subject: [PATCH 1/4] Loosen the docker-api version requirement so we can use a version with TLS. --- hoosegow.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hoosegow.gemspec b/hoosegow.gemspec index 7426595..bb7c7b0 100644 --- a/hoosegow.gemspec +++ b/hoosegow.gemspec @@ -28,5 +28,5 @@ Gem::Specification.new do |s| s.add_development_dependency 'rspec', '>= 2.14.1', '~> 2.14' s.add_runtime_dependency 'msgpack', '>= 0.5.6', '~> 0.5' s.add_runtime_dependency 'yajl-ruby', '>= 1.1.0', '~> 1.1' - s.add_runtime_dependency 'docker-api', '~> 1.13.6' + s.add_runtime_dependency 'docker-api', '>= 1.13.6', '< 2.0' end From ec4877d902d0150f334f7255cdacc34a549fd824 Mon Sep 17 00:00:00 2001 From: Matt Burke Date: Tue, 20 Jan 2015 10:11:21 -0500 Subject: [PATCH 2/4] Don't override the docker url that it found in the env. boot2docker sets env vars like this: export DOCKER_HOST=tcp://192.168.59.104:2376 export DOCKER_CERT_PATH=/Users/spraints/.boot2docker/certs/porter export DOCKER_TLS_VERIFY=1 The docker-api gem initializes `Docker.url` from these variables. If boot2docker and docker-api already know what the docker connection is, we don't need to mess with it in hoosegow. --- lib/hoosegow/docker.rb | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/hoosegow/docker.rb b/lib/hoosegow/docker.rb index 359d9d0..716edb0 100644 --- a/lib/hoosegow/docker.rb +++ b/lib/hoosegow/docker.rb @@ -38,7 +38,7 @@ class Docker # :Other - any option with a capitalized key will be passed on # to the 'create container' call. See http://docs.docker.io/en/latest/reference/api/docker_remote_api_v1.9/#create-a-container def initialize(options = {}) - ::Docker.url = docker_url options + set_docker_url! options @after_create = options[:after_create] @after_start = options[:after_start] @after_stop = options[:after_stop] @@ -168,6 +168,13 @@ def image_exist?(name) end private + # Private: Set the docker URL, if related options are present. + def set_docker_url!(options) + if url = docker_url(options) + ::Docker.url = url + end + end + # Private: Get the URL to use for communicating with Docker. If a host and/or # port a present, a TCP socket URL will be generated. Otherwise a Unix # socket will be used. @@ -184,9 +191,10 @@ def docker_url(options) host = options[:host] || DEFAULT_HOST port = options[:port] || DEFAULT_PORT "tcp://#{host}:#{port}" - else - path = options[:socket] || DEFAULT_SOCKET + elsif path = options[:socket] "unix://#{path}" + else + nil end end From 782b14aed8bfe1f98eca0756ebaa972ee95c1dcc Mon Sep 17 00:00:00 2001 From: Matt Burke Date: Tue, 16 Jun 2015 16:10:01 -0400 Subject: [PATCH 3/4] Need docker-api v1.15 for boot2docker support This is when docker-api learned about the `DOCKER_*` environment variables. --- hoosegow.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hoosegow.gemspec b/hoosegow.gemspec index bb7c7b0..84cbe04 100644 --- a/hoosegow.gemspec +++ b/hoosegow.gemspec @@ -28,5 +28,5 @@ Gem::Specification.new do |s| s.add_development_dependency 'rspec', '>= 2.14.1', '~> 2.14' s.add_runtime_dependency 'msgpack', '>= 0.5.6', '~> 0.5' s.add_runtime_dependency 'yajl-ruby', '>= 1.1.0', '~> 1.1' - s.add_runtime_dependency 'docker-api', '>= 1.13.6', '< 2.0' + s.add_runtime_dependency 'docker-api', '~> 1.15' end From 15fd2e4de375edbf9332ae2e847f16fa2c88919c Mon Sep 17 00:00:00 2001 From: Matt Burke Date: Tue, 16 Jun 2015 17:34:52 -0400 Subject: [PATCH 4/4] Need the fix in https://github.com/swipely/docker-api/pull/251 --- hoosegow.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hoosegow.gemspec b/hoosegow.gemspec index 84cbe04..4e1ce0d 100644 --- a/hoosegow.gemspec +++ b/hoosegow.gemspec @@ -28,5 +28,5 @@ Gem::Specification.new do |s| s.add_development_dependency 'rspec', '>= 2.14.1', '~> 2.14' s.add_runtime_dependency 'msgpack', '>= 0.5.6', '~> 0.5' s.add_runtime_dependency 'yajl-ruby', '>= 1.1.0', '~> 1.1' - s.add_runtime_dependency 'docker-api', '~> 1.15' + s.add_runtime_dependency 'docker-api', '~> 1.19' end