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,
ExecConfig execConfig)
Run a command inside a running container, as though using "docker exec".
|
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(ExecConfig execConfig)
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 Container.ExecResult |
execInContainerWithUser(java.nio.charset.Charset outputCharset,
java.lang.String user,
java.lang.String... command)
Deprecated.
|
default Container.ExecResult |
execInContainerWithUser(java.lang.String user,
java.lang.String... command)
Deprecated.
|
default java.util.List<java.lang.Integer> |
getBoundPortNumbers() |
default java.lang.String |
getContainerId() |
com.github.dockerjava.api.command.InspectContainerResponse |
getContainerInfo()
Returns the container inspect response.
|
default java.lang.String |
getContainerIpAddress()
Deprecated.
use
getHost() |
default com.github.dockerjava.api.command.InspectContainerResponse |
getCurrentContainerInfo()
Inspects the container and returns up-to-date inspection response.
|
default com.github.dockerjava.api.DockerClient |
getDockerClient() |
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 com.github.dockerjava.api.DockerClient getDockerClient()
default java.lang.String getHost()
default boolean isRunning()
default boolean isCreated()
default boolean isHealthy()
default com.github.dockerjava.api.command.InspectContainerResponse getCurrentContainerInfo()
getContainerInfo()
default java.lang.Integer getFirstMappedPort()
getHost()
.java.lang.IllegalStateException
- if there are no exposed portsdefault java.lang.Integer getMappedPort(int originalPort)
getHost()
.
Note: The returned port number might be outdated (for instance, after disconnecting from a network and reconnecting
again). If you always need up-to-date value, override the getContainerInfo()
to return the
getCurrentContainerInfo()
.
originalPort
- the original TCP port that is exposedgetContainerInfo()
,
getCurrentContainerInfo()
java.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()
getCurrentContainerInfo()
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
execInContainer(Charset, 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(DockerClient, InspectContainerResponse, Charset, String...)
@Deprecated default Container.ExecResult execInContainerWithUser(java.lang.String user, java.lang.String... command) throws java.lang.UnsupportedOperationException, java.io.IOException, java.lang.InterruptedException
execInContainer(ExecConfig)
java.lang.UnsupportedOperationException
java.io.IOException
java.lang.InterruptedException
ExecInContainerPattern.execInContainerWithUser(DockerClient, InspectContainerResponse, String, String...)
@Deprecated default Container.ExecResult execInContainerWithUser(java.nio.charset.Charset outputCharset, java.lang.String user, java.lang.String... command) throws java.lang.UnsupportedOperationException, java.io.IOException, java.lang.InterruptedException
execInContainer(Charset, ExecConfig)
java.lang.UnsupportedOperationException
java.io.IOException
java.lang.InterruptedException
ExecInContainerPattern.execInContainerWithUser(DockerClient, InspectContainerResponse, Charset, String, String...)
default Container.ExecResult execInContainer(ExecConfig execConfig) throws java.lang.UnsupportedOperationException, java.io.IOException, java.lang.InterruptedException
java.lang.UnsupportedOperationException
java.io.IOException
java.lang.InterruptedException
default Container.ExecResult execInContainer(java.nio.charset.Charset outputCharset, ExecConfig execConfig) throws java.lang.UnsupportedOperationException, java.io.IOException, java.lang.InterruptedException
java.lang.UnsupportedOperationException
java.io.IOException
java.lang.InterruptedException
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