Class TestcontainersConfiguration

java.lang.Object
org.testcontainers.utility.TestcontainersConfiguration

public class TestcontainersConfiguration extends Object
Provides a mechanism for fetching configuration/default settings.

Configuration may be provided in:

  • A file in the user's home directory named .testcontainers.properties
  • A file in the classpath named testcontainers.properties
  • Environment variables

Note that, if using environment variables, property names are in upper case separated by underscores, preceded by TESTCONTAINERS_.

  • Method Details

    • getAmbassadorContainerImage

      @Deprecated public String getAmbassadorContainerImage()
      Deprecated.
    • getSocatContainerImage

      @Deprecated public String getSocatContainerImage()
      Deprecated.
    • getVncRecordedContainerImage

      @Deprecated public String getVncRecordedContainerImage()
      Deprecated.
    • getDockerComposeContainerImage

      @Deprecated public String getDockerComposeContainerImage()
      Deprecated.
    • getTinyImage

      @Deprecated public String getTinyImage()
      Deprecated.
    • isRyukPrivileged

      public boolean isRyukPrivileged()
    • getRyukImage

      @Deprecated public String getRyukImage()
      Deprecated.
    • getSSHdImage

      @Deprecated public String getSSHdImage()
      Deprecated.
    • getRyukTimeout

      public Integer getRyukTimeout()
    • getKafkaImage

      @Deprecated public String getKafkaImage()
      Deprecated.
    • getOracleImage

      @Deprecated public String getOracleImage()
      Deprecated.
    • getPulsarImage

      @Deprecated public String getPulsarImage()
      Deprecated.
    • getLocalStackImage

      @Deprecated public String getLocalStackImage()
      Deprecated.
    • isDisableChecks

      public boolean isDisableChecks()
    • environmentSupportsReuse

      @UnstableAPI public boolean environmentSupportsReuse()
    • getDockerClientStrategyClassName

      public String getDockerClientStrategyClassName()
    • getTransportType

      public String getTransportType()
    • getImagePullPauseTimeout

      public Integer getImagePullPauseTimeout()
    • getImagePullTimeout

      public Integer getImagePullTimeout()
    • getImageSubstitutorClassName

      public String getImageSubstitutorClassName()
    • getImagePullPolicy

      public String getImagePullPolicy()
    • getClientPingTimeout

      public Integer getClientPingTimeout()
    • getEnvVarOrProperty

      @Contract("_, !null -> !null") public String getEnvVarOrProperty(@NotNull @NotNull String propertyName, @Nullable @Nullable String defaultValue)
      Gets a configured setting from an environment variable (if present) or a configuration file property otherwise. The configuration file will be the .testcontainers.properties file in the user's home directory or a testcontainers.properties found on the classpath.

      Note that when searching environment variables, the prefix `TESTCONTAINERS_` will usually be applied to the property name, which will be converted to upper-case with underscore separators. This prefix will not be added if the property name begins `docker.`.

      Parameters:
      propertyName - name of configuration file property (dot-separated lower case)
      Returns:
      the found value, or null if not set
    • getEnvVarOrUserProperty

      @Contract("_, !null -> !null") public String getEnvVarOrUserProperty(@NotNull @NotNull String propertyName, @Nullable @Nullable String defaultValue)
      Gets a configured setting from an environment variable (if present) or a configuration file property otherwise. The configuration file will be the .testcontainers.properties file in the user's home directory.

      Note that when searching environment variables, the prefix `TESTCONTAINERS_` will usually be applied to the property name, which will be converted to upper-case with underscore separators. This prefix will not be added if the property name begins `docker.`.

      Parameters:
      propertyName - name of configuration file property (dot-separated lower case)
      Returns:
      the found value, or null if not set
    • getUserProperty

      @Contract("_, !null -> !null") public String getUserProperty(@NotNull @NotNull String propertyName, @Nullable @Nullable String defaultValue)
      Gets a configured setting from ~/.testcontainers.properties.
      Parameters:
      propertyName - name of configuration file property (dot-separated lower case)
      Returns:
      the found value, or null if not set
    • getProperties

      @Deprecated public Properties getProperties()
      Deprecated.
      Returns:
      properties values available from user properties and classpath properties. Values set by environment variable are NOT included.
    • updateGlobalConfig

      @Deprecated public boolean updateGlobalConfig(@NonNull @NonNull String prop, @NonNull @NonNull String value)
      Deprecated.
    • updateUserConfig

      public boolean updateUserConfig(@NonNull @NonNull String prop, @NonNull @NonNull String value)
    • getUserProperties

      public Properties getUserProperties()
    • getClasspathProperties

      public Properties getClasspathProperties()
    • getEnvironment

      public Map<String,String> getEnvironment()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getInstance

      public static TestcontainersConfiguration getInstance()