Method: Beaker::Docker#initialize
- Defined in:
- lib/beaker/hypervisor/docker.rb
#initialize(hosts, options) ⇒ Docker
Docker hypvervisor initializtion Env variables supported: DOCKER_REGISTRY: Docker registry URL DOCKER_HOST: Remote docker host
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/beaker/hypervisor/docker.rb', line 11 def initialize(hosts, ) require 'docker' @options = @logger = [:logger] @hosts = hosts # increase the http timeouts as provisioning images can be slow = { :write_timeout => 300, :read_timeout => 300 }.merge(::Docker. || {}) # Merge docker options from the entry in hosts file ::Docker. = .merge(@options[:docker_options] || {}) # assert that the docker-api gem can talk to your docker # enpoint. Will raise if there is a version mismatch begin ::Docker.validate_version! rescue Excon::Errors::SocketError => e raise "Docker instance not connectable.\nError was: #{e}\nCheck your DOCKER_HOST variable has been set\nIf you are on OSX or Windows, you might not have Docker Machine setup correctly: https://docs.docker.com/machine/\n" end # Pass on all the logging from docker-api to the beaker logger instance ::Docker.logger = @logger # Find out what kind of remote instance we are talking against if ::Docker.version['Version'] =~ /swarm/ @docker_type = 'swarm' unless ENV['DOCKER_REGISTRY'] raise "Using Swarm with beaker requires a private registry. Please setup the private registry and set the 'DOCKER_REGISTRY' env var" else @registry = ENV['DOCKER_REGISTRY'] end else @docker_type = 'docker' end end |