module

Testcontainers::DockerClient

DockerClient provides a singleton-like access to the Docr API client which communicates with the Docker daemon via the UNIX socket.

Constants

SESSION_ID = UUID.random.to_s
TESTCONTAINERS_LABEL = "org.testcontainers"
TESTCONTAINERS_LANG_LABEL = "#{TESTCONTAINERS_LABEL}.lang"
TESTCONTAINERS_SESSION_ID_LABEL = "#{TESTCONTAINERS_LABEL}.sessionId"
TESTCONTAINERS_VERSION_LABEL = "#{TESTCONTAINERS_LABEL}.version"

Class methods

api

Returns the shared Docr::API instance, creating it if needed.

The API instance uses the Docker socket at /var/run/docker.sock or the path specified by the DOCKER_HOST environment variable.

Source
default_labels

Returns the default marker labels applied to Testcontainers resources.

Source
host

Returns the Docker host address.

Resolution order:

  1. TC_HOST environment variable
  2. DOCKER_HOST environment variable (parsed)
  3. "localhost" as fallback
Source
inside_container?

Returns true if the current process is running inside a Docker container

Source
reset!

Resets the cached API instance. Useful for testing.

Source