Class: Kitchen::Transport::Docker
- Inherits:
-
Base
- Object
- Base
- Kitchen::Transport::Docker
- Defined in:
- lib/kitchen/transport/docker.rb
Overview
Test Kitchen transport that runs commands inside a Docker container.
Commands go through docker exec rather than a network protocol, so no
SSH or WinRM server is needed inside the image.
Defined Under Namespace
Classes: Connection, DockerFailed
Instance Method Summary collapse
-
#connection(state) {|connection| ... } ⇒ Connection
Builds a connection to the container.
Instance Method Details
#connection(state) {|connection| ... } ⇒ Connection
Builds a connection to the container.
DOCKER_HOST is exported here because the docker-api gem, used by the
InSpec verifier, reads the daemon address from the environment rather
than from Test Kitchen's configuration.
84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/kitchen/transport/docker.rb', line 84 def connection(state, &block) = config.to_hash.merge(state) [: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"] = [:socket] if ![:socket].nil? && ENV["DOCKER_HOST"].nil? Kitchen::Transport::Docker::Connection.new(, &block) end |