Class DockerUtils

java.lang.Object
io.debezium.testing.testcontainers.util.DockerUtils

public class DockerUtils extends Object
  • Field Details

  • Constructor Details

    • DockerUtils

      private DockerUtils()
  • Method Details

    • isContainerVM

      public static boolean isContainerVM()
      Checks if system is configured to deploy fake DNS.
    • isMac

      public static boolean isMac()
      Check if running OS is Mac.
    • logContainerVMBanner

      public static void logContainerVMBanner(org.slf4j.Logger logger, Collection<String> hosts, boolean skip)
      If required logs warning banner about required /etc/hosts entries
      The operation is not required and skipped if:
      • Containers are not running under Docker Desktop
      • Skip parameter is true
      • CONTAINER_VM_LOG_SKIP property is true
      • FakeDns is installed within JVM
      Parameters:
      logger - logger used to print the banner
      hosts - list of container hostnames
      skip - if true the operation is skipped
    • enableFakeDnsIfRequired

      public static void enableFakeDnsIfRequired()
      Enables FakeDns on docker desktop (if
    • disableFakeDns

      public static void disableFakeDns()
      Disables FakeDns if enabled
    • addFakeDnsEntry

      public static void addFakeDnsEntry(String hostname)
      If FakeDns is enabled, maps given hostname to InetAddress.getLoopbackAddress()
      Parameters:
      hostname - mapped hostname
    • addFakeDnsEntry

      public static void addFakeDnsEntry(String hostname, InetAddress address)
      If FakeDns is enabled, maps given hostname to given address
      Parameters:
      hostname - mapped hostname
      address - resolution address
    • removeFakeDnsEntry

      public static void removeFakeDnsEntry(String hostname)
      If FakeDns is enabled, remove mapping of given hostname to InetAddress.getLoopbackAddress()
      Parameters:
      hostname - mapped hostname
    • removeFakeDnsEntry

      public static void removeFakeDnsEntry(String hostname, InetAddress address)
      If FakeDns is enabled, remove given mapping
      Parameters:
      hostname - mapped hostname
      address - resolution address