public interface ContainerManager
The container management layer can be Docker or trust-X.
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
getMetadata(java.lang.String containerID)
Returns metadata associated with the service running in the container.
|
java.lang.String |
getVersion()
Returns the container management layer which is currently in use.
|
java.lang.String |
inspectContainer(java.lang.String containerID)
Retrieves configuration data about a container.
|
java.util.List<ApplicationContainer> |
list(boolean onlyRunning)
List currently installed containers.
|
java.util.Optional<java.lang.String> |
pullImage(ApplicationContainer app)
Pulls an image from the online registry.
|
void |
restartContainer(java.lang.String containerID)
Restarts a container without stopping it first.
|
void |
setIpRule(java.lang.String containerID,
Direction direction,
int srcPort,
int dstPort,
java.lang.String srcDstRange,
Protocol protocol,
Decision decision)
Configures an IP rule for a container.
|
void |
startContainer(java.lang.String containerID,
java.lang.String key)
Starts a container.
|
void |
stopContainer(java.lang.String containerID)
Stops a container.
|
void |
wipe(java.lang.String containerID)
Wipes are container from disk, i.e. removes it irreversibly.
|
java.lang.String getVersion()
One of docker, trust-X, none.
java.util.List<ApplicationContainer> list(boolean onlyRunning)
The respective docker command is: docker ps -a.
onlyRunning - If set to true, only currently running containers are displayed.void wipe(java.lang.String containerID) throws NoContainerExistsException
containerID - Hash of the container.NoContainerExistsExceptionvoid startContainer(java.lang.String containerID,
java.lang.String key)
throws NoContainerExistsException
If the container is already running, this method will do nothing.
The container must already exist, otherwise an exception will be thrown.
containerID - key - NoContainerExistsExceptionvoid stopContainer(java.lang.String containerID)
throws NoContainerExistsException
A stopped container does not execute any processes, but its persisted data is still present.
It can be started by startContainer again, i.e. the sequence stopContainer(x);
startContainer(X); has no effect. *
If the container is already stopped, this method will do nothing.
The container must already exist, otherwise an exception will be thrown.
containerID - NoContainerExistsExceptionvoid restartContainer(java.lang.String containerID)
throws NoContainerExistsException
The container must already exist, otherwise an exception will be thrown.
containerID - NoContainerExistsExceptionjava.lang.String inspectContainer(java.lang.String containerID)
throws NoContainerExistsException
The data format returned will depend on the underlying CML implementation. As for docker,
this command will return the output of the command docker inspect.
If meta data is stored in container labels, the result of getMetaData will also
be contained in the result of this method.
containerID - ID of the container. If does not exist, a NoContainerExistsException will be
thrown.NoContainerExistsExceptionjava.lang.Object getMetadata(java.lang.String containerID)
throws NoContainerExistsException
The data format returned depends on the meta data implementation, but will usually be RDF.
containerID - NoContainerExistsExceptionjava.util.Optional<java.lang.String> pullImage(ApplicationContainer app) throws NoContainerExistsException
The online registry can be given as a URL. If it is not given, the standard Docker registry is used in case of a Docker CML implementation.
This method blocks until the image has been pulled or an exception has occurred. As this is a long running operation, it should always be called in a separate thread.
image - NoContainerExistsExceptionvoid setIpRule(java.lang.String containerID,
Direction direction,
int srcPort,
int dstPort,
java.lang.String srcDstRange,
Protocol protocol,
Decision decision)
By default, containers do not have IP connectivity, i.e. all inbound and outbound traffic is blocked.
This method can be used to allow specific communication channels from/to a container.
containerID - ID of the container. It must exist, otherwise a NoContainerExistsException
will be thrown.direction - INBOUND for traffic going into the container or OUTBOUND for traffic leaving
the container. Replies within established TCP sessions will always be allowed, there is no
need to configure them.srcPort - IP source port.dstPort - IP destination port.srcDestRange - Remote IP, i.e. for OUTBOUND traffic, IP range of the destination. For
INBOUND traffic, IP range of the source.protocol - TPC or UDP.decision - ALLOW, DENY, or DROP