Class DockerRunCommand
java.lang.Object
org.apache.storm.container.docker.DockerCommand
org.apache.storm.container.docker.DockerRunCommand
Encapsulates the docker run command and its command line arguments.
- 
Constructor SummaryConstructorsConstructorDescriptionDockerRunCommand(String containerName, String userInfo, String image) The Construction function.
- 
Method SummaryModifier and TypeMethodDescriptionaddAllReadOnlyMountLocations(List<String> paths) Add all readonly locations.addAllReadOnlyMountLocations(List<String> paths, boolean createSource) Add all readonly locations.addAllReadWriteMountLocations(List<String> paths) Add all the rw bind mount locations.addAllReadWriteMountLocations(List<String> paths, boolean createSource) Add all the rw bind mount locations.addCpuSetBindings(List<String> cores, String memoryNode) Set --device option.addReadOnlyMountLocation(String sourcePath, String destinationPath) Add readonly bind mout location.addReadOnlyMountLocation(String sourcePath, String destinationPath, boolean createSource) Add readonly bind mount location.addReadWriteMountLocation(String sourcePath, String destinationPath) addReadWriteMountLocation(String sourcePath, String destinationPath, boolean createSource) Add bind mount locations.Add -d option.Disable detach.Enable detach.Get the full command.Set --group-add option.Add --rm option.setCapabilities(Set<String> capabilities) Set capabilities of the container.setCGroupParent(String parentPath) Set --cgroup-parent option.setCidFile(String cidFile) Set the output container id file location.setContainerWorkDir(String workdir) Set --workdir option.setCpus(double cpus) Set the number of cpus to use.setCpuShares(int cpuShares) Set cpuShares.setMemoryMb(int memoryMb) Set the number of memory in MB to use.setNetworkType(String type) Set --net option.Set no-new-privileges option.setOverrideCommandWithArgs(List<String> overrideCommandWithArgs) Set extra commands and args.Set --privileged option to run a privileged container.Add --read-only option.setSeccompProfile(String jsonPath) Set --security-opt option.Methods inherited from class org.apache.storm.container.docker.DockerCommandaddCommandArguments, getCommandOption
- 
Constructor Details- 
DockerRunCommandThe Construction function.- Parameters:
- containerName- the container name
- userInfo- the info of the user, e.g. "uid:gid"
- image- the container image
 
 
- 
- 
Method Details- 
removeContainerOnExitAdd --rm option.- Returns:
- the self
 
- 
detachOnRunAdd -d option.- Returns:
- the self
 
- 
setContainerWorkDirSet --workdir option.- Parameters:
- workdir- the working directory
- Returns:
- the self
 
- 
setNetworkTypeSet --net option.- Parameters:
- type- the network type
- Returns:
- the self
 
- 
addReadWriteMountLocationpublic DockerRunCommand addReadWriteMountLocation(String sourcePath, String destinationPath, boolean createSource) throws IOException Add bind mount locations.- Parameters:
- sourcePath- the source path
- destinationPath- the destination path
- createSource- if createSource is false and the source path doesn't exist, do nothing
- Returns:
- the self
- Throws:
- IOException
 
- 
addReadWriteMountLocationpublic DockerRunCommand addReadWriteMountLocation(String sourcePath, String destinationPath) throws IOException - Throws:
- IOException
 
- 
addAllReadWriteMountLocationsAdd all the rw bind mount locations.- Parameters:
- paths- the locations
- Returns:
- the self
- Throws:
- IOException
 
- 
addAllReadWriteMountLocationspublic DockerRunCommand addAllReadWriteMountLocations(List<String> paths, boolean createSource) throws IOException Add all the rw bind mount locations.- Parameters:
- paths- the locations
- createSource- if createSource is false and the source path doesn't exist, do nothing
- Returns:
- the self
- Throws:
- IOException
 
- 
addReadOnlyMountLocationpublic DockerRunCommand addReadOnlyMountLocation(String sourcePath, String destinationPath, boolean createSource) throws IOException Add readonly bind mount location.- Parameters:
- sourcePath- the source path
- destinationPath- the destination path
- createSource- if createSource is false and the source path doesn't exist, do nothing
- Returns:
- the self
- Throws:
- IOException
 
- 
addReadOnlyMountLocationpublic DockerRunCommand addReadOnlyMountLocation(String sourcePath, String destinationPath) throws IOException Add readonly bind mout location.- Parameters:
- sourcePath- the source path
- destinationPath- the destination path
- Returns:
- the self
- Throws:
- IOException
 
- 
addAllReadOnlyMountLocationsAdd all readonly locations.- Parameters:
- paths- the locations
- Returns:
- the self
- Throws:
- IOException
 
- 
addAllReadOnlyMountLocationspublic DockerRunCommand addAllReadOnlyMountLocations(List<String> paths, boolean createSource) throws IOException Add all readonly locations.- Parameters:
- paths- the locations
- createSource- if createSource is false and the source path doesn't exist, do nothing
- Returns:
- the self
- Throws:
- IOException
 
- 
addCpuSetBindings
- 
setCGroupParentSet --cgroup-parent option.- Parameters:
- parentPath- the cgroup parent path
- Returns:
- the self
 
- 
setPrivilegedSet --privileged option to run a privileged container. Use with extreme care.- Returns:
- the self.
 
- 
setCapabilitiesSet capabilities of the container.- Parameters:
- capabilities- the capabilities to be added
- Returns:
- the self
 
- 
addDeviceSet --device option.- Parameters:
- sourceDevice- the source device
- destinationDevice- the destination device
- Returns:
- the self
 
- 
enableDetachEnable detach.- Returns:
- the self
 
- 
disableDetachDisable detach.- Returns:
- the self
 
- 
groupAddSet --group-add option.- Parameters:
- groups- the groups to be added
- Returns:
- the self
 
- 
setOverrideCommandWithArgsSet extra commands and args. It can override the existing commands.- Parameters:
- overrideCommandWithArgs- the extra commands and args
- Returns:
- the self
 
- 
setReadonlyAdd --read-only option.- Returns:
- the self
 
- 
setSeccompProfileSet --security-opt option.- Parameters:
- jsonPath- the path to the json file
- Returns:
- the self
 
- 
setNoNewPrivilegesSet no-new-privileges option.- Returns:
- the self
 
- 
setCpusSet the number of cpus to use.- Parameters:
- cpus- the number of cpus
- Returns:
- the self
 
- 
setMemoryMbSet the number of memory in MB to use.- Parameters:
- memoryMb- the number of memory in MB
- Returns:
- the self
 
- 
setCidFileSet the output container id file location.- Parameters:
- cidFile- the container id file
- Returns:
- the self
 
- 
getCommandWithArgumentsGet the full command.- Overrides:
- getCommandWithArgumentsin class- DockerCommand
- Returns:
- the full command
 
 
-