Class: Kitchen::Transport::Docker

Inherits:
Base
  • Object
show all
Defined in:
lib/kitchen/transport/docker.rb

Defined Under Namespace

Classes: Connection, DockerFailed

Instance Method Summary collapse

Instance Method Details

#connection(state, &block) ⇒ Object



68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/kitchen/transport/docker.rb', line 68

def connection(state, &block)
  options = config.to_hash.merge(state)
  options[:platform] = instance.platform.name

  # Set value for DOCKER_HOST environment variable for the docker-api gem
  # This allows Windows systems to use the TCP socket for the InSpec verifier
  # See the lib/docker.rb file here: https://github.com/swipely/docker-api/blob/master/lib/docker.rb
  # default_socket_url is set to a Unix socket and env_url requires an environment variable to be set
  ENV['DOCKER_HOST'] = options[:socket] if !options[:socket].nil? && ENV['DOCKER_HOST'].nil?

  Kitchen::Transport::Docker::Connection.new(options, &block)
end