Class DockerClientProviderStrategy

java.lang.Object
org.testcontainers.dockerclient.DockerClientProviderStrategy
Direct Known Subclasses:
DockerDesktopClientProviderStrategy, DockerMachineClientProviderStrategy, EnvironmentAndSystemPropertyClientProviderStrategy, NpipeSocketClientProviderStrategy, RootlessDockerClientProviderStrategy, TestcontainersHostPropertyClientProviderStrategy, UnixSocketClientProviderStrategy

public abstract class DockerClientProviderStrategy extends Object
Mechanism to find a viable Docker client configuration according to the host system environment.

The order is:

  • TestcontainersHostPropertyClientProviderStrategy
  • EnvironmentAndSystemPropertyClientProviderStrategy
  • Persistable DockerClientProviderStrategy in ~/.testcontainers.properties
  • Other strategies order by priority
  • Constructor Details

    • DockerClientProviderStrategy

      public DockerClientProviderStrategy()
  • Method Details

    • getDescription

      public abstract String getDescription()
      Returns:
      a short textual description of the strategy
    • isApplicable

      protected boolean isApplicable()
    • isPersistable

      protected boolean isPersistable()
    • allowUserOverrides

      public boolean allowUserOverrides()
    • getRemoteDockerUnixSocketPath

      public String getRemoteDockerUnixSocketPath()
      /* @return the path under which the Docker unix socket is reachable relative to the Docker daemon
    • getPriority

      protected int getPriority()
      Returns:
      highest to lowest priority value
    • getTransportConfig

      public abstract TransportConfig getTransportConfig() throws InvalidConfigurationException
      Throws:
      InvalidConfigurationException - if this strategy fails
    • getClient

      @Deprecated public com.github.dockerjava.api.DockerClient getClient()
      Deprecated.
      Returns:
      a usable, tested, Docker client configuration for the host system environment
    • test

      @UnstableAPI protected boolean test()
      TODO we should consider moving this to docker-java at some point
    • getFirstValidStrategy

      public static DockerClientProviderStrategy getFirstValidStrategy(List<DockerClientProviderStrategy> strategies)
      Determine the right DockerClientConfig to use for building clients by trial-and-error.
      Returns:
      a working DockerClientConfig, as determined by successful execution of a ping command
    • getClientForConfig

      public static com.github.dockerjava.api.DockerClient getClientForConfig(TransportConfig transportConfig)
    • getDockerHostIpAddress

      public String getDockerHostIpAddress()
    • getDockerClient

      public com.github.dockerjava.api.DockerClient getDockerClient()
    • getInfo

      public com.github.dockerjava.api.model.Info getInfo()