Class DockerContainer
java.lang.Object
org.jenkinsci.test.acceptance.docker.DockerContainer
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Direct Known Subclasses:
DynamicDockerContainer
,SshdContainer
Running container, a virtual machine.
- Author:
- Kohsuke Kawaguchi
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
close()
Stops and remove any trace of the containerboolean
Deprecated.do not call inside container.getCid()
IP address of this container reachable through the bridge.long
getPid()
com.fasterxml.jackson.databind.JsonNode
inspect()
Provides details of this container.ipBound
(int n) Finds the ephemeral ip that the given container TCP port is bind to.ipUdpBound
(int n) Finds the ephemeral ip that the given container UDP port is bind to.static boolean
int
port
(int n) Finds the ephemeral port that the given container port is mapped to.By convention, docker fixtures put their resources into a sub-directory that has the same name as the class name.boolean
Support the case when ATHs are running in a docker container and using the host docker service to spin "sibling" containers, as described in http://jpetazzo.github.io/2015/09/03/do-not-use-docker-in-docker-for-ci/toString()
int
udpPort
(int n) Finds the ephemeral UDP port that the given container port is mapped to.
-
Constructor Details
-
DockerContainer
public DockerContainer()
-
-
Method Details
-
assertRunning
public void assertRunning() -
resource
By convention, docker fixtures put their resources into a sub-directory that has the same name as the class name. -
getCid
-
getLogfile
-
getPid
public long getPid() -
ipBound
Finds the ephemeral ip that the given container TCP port is bind to. -
ipUdpBound
Finds the ephemeral ip that the given container UDP port is bind to. -
port
public int port(int n) Finds the ephemeral port that the given container port is mapped to. -
udpPort
public int udpPort(int n) Finds the ephemeral UDP port that the given container port is mapped to. -
close
public void close()Stops and remove any trace of the container- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
cp
Deprecated.do not call inside container. File ownership does not work the same way for copying from one docker container to another, see https://forums.docker.com/t/can-docker-cp-set-user-id-and-group/21562Copies a file or folder from inside the container to the outside. Silently overwrites an existing file.- Parameters:
from
- the absolute path of the resource to copytoPath
- the absolute path of the destination directory- Returns:
true
if the copy was a success otherwisefalse
-
inspect
Provides details of this container.- Throws:
IOException
-
getIpAddress
IP address of this container reachable through the bridge.- Throws:
IOException
-
toString
-
sharingHostDockerService
public boolean sharingHostDockerService()Support the case when ATHs are running in a docker container and using the host docker service to spin "sibling" containers, as described in http://jpetazzo.github.io/2015/09/03/do-not-use-docker-in-docker-for-ci/ -
ipv6Enabled
public static boolean ipv6Enabled()
-