Interface GenericContainer

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
KubePlayer

public interface GenericContainer extends AutoCloseable
  • Method Details

    • isRunning

      boolean isRunning()
      Check if service is running.
      Returns:
      check result.
    • getClient

      PodmanClient getClient()
      Get API client.
      Returns:
      API client.
    • start

      void start() throws PodmanException
      Creates the pod or container and immediately starts it. All created resources will be cleared out when a SIGTERM is received or pods exit.
      Throws:
      PodmanException
    • stop

      void stop() throws PodmanException
      Stops the pod or container with clearing created volumes.
      Throws:
      PodmanException
    • withExposedService

      GenericContainer withExposedService(String serviceName, Integer exposedPort) throws PodmanException
      Specify service and its port for expose.
      Parameters:
      serviceName - name of service to expose.
      exposedPort - port to expose.
      Returns:
      container with exposed services.
      Throws:
      PodmanException
    • withCleanup

      GenericContainer withCleanup(boolean doCleanup)
      Do resources cleanup after stopping.
      Parameters:
      doCleanup - default is true.
      Returns:
      customised container.
    • withRemoveVolumes

      GenericContainer withRemoveVolumes(boolean doRemoveVolumes)
      Do volumes cleanup after stopping.
      Parameters:
      doRemoveVolumes - default is true.
      Returns:
      customised container.
    • getMappedHost

      default String getMappedHost() throws PodmanException
      Getting mapped host
      Returns:
      mapped host.
      Throws:
      PodmanException
    • getMappedPort

      Integer getMappedPort(String serviceName, Integer exposedPort) throws PodmanException
      Getting mapped port for the given service's name and exposed port.
      Parameters:
      serviceName - the service name.
      exposedPort - the exposed port.
      Returns:
      mapped host.
      Throws:
      PodmanException
    • close

      default void close() throws Exception
      Specified by:
      close in interface AutoCloseable
      Throws:
      Exception