Skip to content
This repository has been archived by the owner on May 9, 2022. It is now read-only.

Commit

Permalink
Merge pull request #5 from spraints/boot2docker-tls
Browse files Browse the repository at this point in the history
Support boot2docker (and its tcp + ssl thing)
  • Loading branch information
spraints committed Jun 19, 2015
2 parents 6dd503d + 15fd2e4 commit 4c61c96
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion hoosegow.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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.19'
end
14 changes: 11 additions & 3 deletions lib/hoosegow/docker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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.
Expand All @@ -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

Expand Down

0 comments on commit 4c61c96

Please sign in to comment.