Class DockerContainer
- java.lang.Object
-
- org.testcontainers.containers.FailureDetectingExternalResource
-
- org.testcontainers.containers.GenericContainer<SELF>
-
- org.testcontainers.containers.FixedHostPortGenericContainer<DockerContainer>
-
- io.prestosql.tests.product.launcher.env.DockerContainer
-
- All Implemented Interfaces:
AutoCloseable,org.junit.rules.TestRule,org.testcontainers.containers.Container<DockerContainer>,org.testcontainers.containers.ContainerState,org.testcontainers.containers.traits.LinkableContainer,org.testcontainers.containers.wait.strategy.WaitStrategyTarget,org.testcontainers.lifecycle.Startable
public class DockerContainer extends org.testcontainers.containers.FixedHostPortGenericContainer<DockerContainer>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDockerContainer.OutputMode
-
Constructor Summary
Constructors Constructor Description DockerContainer(String dockerImageName, String logicalName)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFileSystemBind(String hostPath, String containerPath, org.testcontainers.containers.BindMode mode)voidaddFileSystemBind(String hostPath, String containerPath, org.testcontainers.containers.BindMode mode, org.testcontainers.containers.SelinuxContext selinuxContext)static voidcleanOrCreateHostPath(Path path)protected voidcontainerIsStarted(com.github.dockerjava.api.command.InspectContainerResponse containerInfo)protected voidcontainerIsStarting(com.github.dockerjava.api.command.InspectContainerResponse containerInfo)protected voidcontainerIsStopped(com.github.dockerjava.api.command.InspectContainerResponse containerInfo)protected voidcontainerIsStopping(com.github.dockerjava.api.command.InspectContainerResponse containerInfo)voidcopyFileToContainer(org.testcontainers.images.builder.Transferable transferable, String containerPath)voidcopyLogsToHostPath(Path hostPath)static voidensurePathExists(Path path)StringexecCommand(String... command)StringgetLogicalName()StatisticsFetcher.StatsgetStats()booleanisHealthy()voidreset()StringtoString()voidtryStop()DockerContainerwaitingForAll(org.testcontainers.containers.wait.strategy.WaitStrategy... strategies)DockerContainerwithEnvironmentListener(Optional<EnvironmentListener> listener)DockerContainerwithExposedLogPaths(String... logPaths)DockerContainerwithFileSystemBind(String hostPath, String containerPath)DockerContainerwithFileSystemBind(String hostPath, String containerPath, org.testcontainers.containers.BindMode mode)DockerContainerwithHealthCheck(Path healthCheckScript)-
Methods inherited from class org.testcontainers.containers.FixedHostPortGenericContainer
withFixedExposedPort, withFixedExposedPort
-
Methods inherited from class org.testcontainers.containers.GenericContainer
addEnv, addExposedPort, addExposedPorts, addFixedExposedPort, addFixedExposedPort, addLink, apply, canBeReused, configure, containerIsCreated, containerIsStarted, containerIsStarting, copyFileFromContainer, createVolumeDirectory, dependsOn, dependsOn, dependsOn, doStart, equals, failed, finished, getBinds, getCommandParts, getContainerId, getContainerInfo, getContainerName, getCopyToFileContainerPathMap, getCreateContainerCmdModifiers, getDependencies, getDockerClient, getDockerImageName, getEnv, getEnvMap, getExposedPorts, getExtraHosts, getImage, getIpAddress, getLabels, getLinkedContainers, getLivenessCheckPort, getLivenessCheckPortNumbers, getLivenessCheckPorts, getLogConsumers, getNetwork, getNetworkAliases, getNetworkMode, getPortBindings, getShmSize, getStartupAttempts, getStartupCheckStrategy, getTestHostIpAddress, getTmpFsMapping, getVolumesFroms, getWaitStrategy, getWorkingDirectory, hashCode, isPrivilegedMode, isShouldBeReused, logger, setBinds, setCommand, setCommand, setCommandParts, setCopyToFileContainerPathMap, setDockerImageName, setEnv, setExposedPorts, setExtraHosts, setImage, setLabels, setLinkedContainers, setLogConsumers, setNetwork, setNetworkAliases, setNetworkMode, setPortBindings, setPrivilegedMode, setShmSize, setStartupAttempts, setStartupCheckStrategy, setTmpFsMapping, setVolumesFroms, setWaitStrategy, setWorkingDirectory, start, starting, stop, succeeded, waitingFor, waitUntilContainerStarted, withClasspathResourceMapping, withClasspathResourceMapping, withCommand, withCommand, withCopyFileToContainer, withCreateContainerCmdModifier, withEnv, withEnv, withExposedPorts, withExtraHost, withImagePullPolicy, withLabel, withLabels, withLogConsumer, withMinimumRunningDuration, withNetwork, withNetworkAliases, withNetworkMode, withPrivilegedMode, withReuse, withSharedMemorySize, withStartupAttempts, withStartupCheckStrategy, withStartupTimeout, withTmpFs, withVolumesFrom, withWorkingDirectory
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.testcontainers.containers.Container
followOutput, followOutput, self, withEnv
-
Methods inherited from interface org.testcontainers.containers.ContainerState
copyFileFromContainer, copyFileToContainer, execInContainer, execInContainer, getBoundPortNumbers, getContainerIpAddress, getCurrentContainerInfo, getFirstMappedPort, getHost, getLogs, getLogs, getMappedPort, isCreated, isRunning
-
-
-
-
Method Detail
-
getLogicalName
public String getLogicalName()
-
withEnvironmentListener
public DockerContainer withEnvironmentListener(Optional<EnvironmentListener> listener)
-
addFileSystemBind
public void addFileSystemBind(String hostPath, String containerPath, org.testcontainers.containers.BindMode mode)
-
addFileSystemBind
public void addFileSystemBind(String hostPath, String containerPath, org.testcontainers.containers.BindMode mode, org.testcontainers.containers.SelinuxContext selinuxContext)
- Specified by:
addFileSystemBindin interfaceorg.testcontainers.containers.Container<DockerContainer>- Overrides:
addFileSystemBindin classorg.testcontainers.containers.GenericContainer<DockerContainer>
-
withFileSystemBind
public DockerContainer withFileSystemBind(String hostPath, String containerPath)
-
withFileSystemBind
public DockerContainer withFileSystemBind(String hostPath, String containerPath, org.testcontainers.containers.BindMode mode)
- Specified by:
withFileSystemBindin interfaceorg.testcontainers.containers.Container<DockerContainer>- Overrides:
withFileSystemBindin classorg.testcontainers.containers.GenericContainer<DockerContainer>
-
copyFileToContainer
public void copyFileToContainer(org.testcontainers.images.builder.Transferable transferable, String containerPath)
-
withExposedLogPaths
public DockerContainer withExposedLogPaths(String... logPaths)
-
withHealthCheck
public DockerContainer withHealthCheck(Path healthCheckScript)
-
containerIsStarting
protected void containerIsStarting(com.github.dockerjava.api.command.InspectContainerResponse containerInfo)
- Overrides:
containerIsStartingin classorg.testcontainers.containers.GenericContainer<DockerContainer>
-
containerIsStarted
protected void containerIsStarted(com.github.dockerjava.api.command.InspectContainerResponse containerInfo)
- Overrides:
containerIsStartedin classorg.testcontainers.containers.GenericContainer<DockerContainer>
-
containerIsStopping
protected void containerIsStopping(com.github.dockerjava.api.command.InspectContainerResponse containerInfo)
- Overrides:
containerIsStoppingin classorg.testcontainers.containers.GenericContainer<DockerContainer>
-
containerIsStopped
protected void containerIsStopped(com.github.dockerjava.api.command.InspectContainerResponse containerInfo)
- Overrides:
containerIsStoppedin classorg.testcontainers.containers.GenericContainer<DockerContainer>
-
copyLogsToHostPath
public void copyLogsToHostPath(Path hostPath)
-
getStats
public StatisticsFetcher.Stats getStats()
-
waitingForAll
public DockerContainer waitingForAll(org.testcontainers.containers.wait.strategy.WaitStrategy... strategies)
-
isHealthy
public boolean isHealthy()
-
reset
public void reset()
-
toString
public String toString()
- Overrides:
toStringin classorg.testcontainers.containers.GenericContainer<DockerContainer>
-
cleanOrCreateHostPath
public static void cleanOrCreateHostPath(Path path)
-
ensurePathExists
public static void ensurePathExists(Path path)
-
tryStop
public void tryStop()
-
-