public interface ContainerState
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
STATE_HEALTHY |
Modifier and Type | Method and Description |
---|---|
default void |
copyFileFromContainer(java.lang.String containerPath,
java.lang.String destinationPath)
Copies a file which resides inside the container to user defined directory
|
default <T> T |
copyFileFromContainer(java.lang.String containerPath,
ThrowingFunction<java.io.InputStream,T> function)
Streams a file which resides inside the container
|
default void |
copyFileToContainer(MountableFile mountableFile,
java.lang.String containerPath)
Copies a file or directory to the container.
|
default void |
copyFileToContainer(Transferable transferable,
java.lang.String containerPath)
Copies a file to the container.
|
default Container.ExecResult |
execInContainer(java.nio.charset.Charset outputCharset,
java.lang.String... command)
Run a command inside a running container, as though using "docker exec".
|
default Container.ExecResult |
execInContainer(java.lang.String... command)
Run a command inside a running container, as though using "docker exec", and interpreting
the output as UTF8.
|
default java.util.List<java.lang.Integer> |
getBoundPortNumbers() |
default java.lang.String |
getContainerId() |
com.github.dockerjava.api.command.InspectContainerResponse |
getContainerInfo() |
default java.lang.String |
getContainerIpAddress()
Deprecated.
use
getHost() |
default com.github.dockerjava.api.command.InspectContainerResponse |
getCurrentContainerInfo() |
java.util.List<java.lang.Integer> |
getExposedPorts() |
default java.lang.Integer |
getFirstMappedPort()
Get the actual mapped port for a first port exposed by the container.
|
default java.lang.String |
getHost()
Get the host that this container may be reached on (may not be the local machine).
|
default java.lang.String |
getLogs() |
default java.lang.String |
getLogs(OutputFrame.OutputType... types) |
default java.lang.Integer |
getMappedPort(int originalPort)
Get the actual mapped port for a given port exposed by the container.
|
default java.util.List<java.lang.String> |
getPortBindings() |
default boolean |
isCreated() |
default boolean |
isHealthy() |
default boolean |
isRunning() |
static final java.lang.String STATE_HEALTHY
@Deprecated default java.lang.String getContainerIpAddress()
getHost()
getHost()
default java.lang.String getHost()
default boolean isRunning()
default boolean isCreated()
default boolean isHealthy()
default com.github.dockerjava.api.command.InspectContainerResponse getCurrentContainerInfo()
default java.lang.Integer getFirstMappedPort()
getHost()
.java.lang.IllegalStateException
- if there are no exposed portsdefault java.lang.Integer getMappedPort(int originalPort)
getHost()
.originalPort
- the original TCP port that is exposedjava.util.List<java.lang.Integer> getExposedPorts()
default java.util.List<java.lang.String> getPortBindings()
default java.util.List<java.lang.Integer> getBoundPortNumbers()
default java.lang.String getLogs()
default java.lang.String getLogs(OutputFrame.OutputType... types)
types
- log types to returndefault java.lang.String getContainerId()
com.github.dockerjava.api.command.InspectContainerResponse getContainerInfo()
default Container.ExecResult execInContainer(java.lang.String... command) throws java.lang.UnsupportedOperationException, java.io.IOException, java.lang.InterruptedException
java.lang.UnsupportedOperationException
java.io.IOException
java.lang.InterruptedException
ExecInContainerPattern.execInContainer(com.github.dockerjava.api.command.InspectContainerResponse, String...)
default Container.ExecResult execInContainer(java.nio.charset.Charset outputCharset, java.lang.String... command) throws java.lang.UnsupportedOperationException, java.io.IOException, java.lang.InterruptedException
java.lang.UnsupportedOperationException
java.io.IOException
java.lang.InterruptedException
ExecInContainerPattern.execInContainer(com.github.dockerjava.api.command.InspectContainerResponse, Charset, String...)
default void copyFileToContainer(MountableFile mountableFile, java.lang.String containerPath)
mountableFile
- file or directory which is copied into the containercontainerPath
- destination path inside the containerdefault void copyFileToContainer(Transferable transferable, java.lang.String containerPath)
transferable
- file which is copied into the containercontainerPath
- destination path inside the containerdefault void copyFileFromContainer(java.lang.String containerPath, java.lang.String destinationPath) throws java.io.IOException, java.lang.InterruptedException
containerPath
- path to file which is copied from containerdestinationPath
- destination path to which file is copied with file namejava.io.IOException
- if there's an issue communicating with Docker or receiving entry from TarArchiveInputStreamjava.lang.InterruptedException
- if the thread waiting for the response is interrupteddefault <T> T copyFileFromContainer(java.lang.String containerPath, ThrowingFunction<java.io.InputStream,T> function)
containerPath
- path to file which is copied from containerfunction
- function that takes InputStream of the copied file