Interface ContainerRuntime
- All Known Subinterfaces:
LinuxContainerRuntime
- All Known Implementing Classes:
DefaultLinuxContainerRuntime,DelegatingLinuxContainerRuntime,DockerLinuxContainerRuntime,JavaSandboxLinuxContainerRuntime,OCIContainerRuntime,RuncContainerRuntime
@Private
@Unstable
public interface ContainerRuntime
An abstraction for various container runtime implementations. Examples
include Process Tree, Docker, Appc runtimes etc. These implementations
are meant for low-level OS container support - dependencies on
higher-level node manager constructs should be avoided.
-
Method Summary
Modifier and TypeMethodDescriptionorg.apache.hadoop.hdfs.protocol.datatransfer.IOStreamPairRun a program in container.getExposedPorts(Container container) Return the exposed ports of the container.String[]getIpAndHost(Container container) Return the host and ip of the container.voidLaunch a container.voidPrepare a container to be ready for launch.voidPerform any container cleanup that may be required.voidRelaunch a container.voidSignal a container.
-
Method Details
-
prepareContainer
Prepare a container to be ready for launch.- Parameters:
ctx- theContainerRuntimeContext- Throws:
ContainerExecutionException- if an error occurs while preparing the container
-
launchContainer
Launch a container.- Parameters:
ctx- theContainerRuntimeContext- Throws:
ContainerExecutionException- if an error occurs while launching the container
-
relaunchContainer
Relaunch a container.- Parameters:
ctx- theContainerRuntimeContext- Throws:
ContainerExecutionException- if an error occurs while relaunching the container
-
signalContainer
Signal a container. Signals may be a request to terminate, a status check, etc.- Parameters:
ctx- theContainerRuntimeContext- Throws:
ContainerExecutionException- if an error occurs while signaling the container
-
reapContainer
Perform any container cleanup that may be required.- Parameters:
ctx- theContainerRuntimeContext- Throws:
ContainerExecutionException- if an error occurs while reaping the container
-
execContainer
org.apache.hadoop.hdfs.protocol.datatransfer.IOStreamPair execContainer(ContainerExecContext ctx) throws ContainerExecutionException Run a program in container.- Parameters:
ctx- theContainerExecContext- Returns:
- stdin and stdout of container exec
- Throws:
ContainerExecutionException
-
getIpAndHost
Return the host and ip of the container.- Parameters:
container- theContainer- Throws:
ContainerExecutionException- if an error occurs while getting the ip and hostname
-
getExposedPorts
Return the exposed ports of the container.- Parameters:
container- theContainer- Returns:
- List of exposed ports
- Throws:
ContainerExecutionException- if an error occurs while getting the exposed ports
-