Class DockerTestUtils

java.lang.Object
no.mnemonic.commons.junit.docker.DockerTestUtils

public class DockerTestUtils extends Object
Utility class for working with Docker environments during unit tests.
  • Method Details

    • getDockerHostVariable

      public static String getDockerHostVariable()
      Return the value of the DOCKER_HOST environment variable.
      Returns:
      DOCKER_HOST environment variable
    • getDockerHost

      public static String getDockerHost()
      Return the hostname extracted from the DOCKER_HOST environment variable.

      This method supports URLs of the format "tcp://hostname:port". If DOCKER_HOST is a unix:// socket or if DOCKER_HOST is not set, this method will return "localhost".

      Returns:
      Extracted hostname