public class DockerUtil extends Object
Modifier and Type | Field and Description |
---|---|
static String |
AWS_EC2_HOME
Docker container dir to map HOST $HOME to save logs + find Config values using $HOME: "/home/ec2-user" Need
to name this dir = "/home/ec2-user" so Nextflow config is same inside + outside of container
|
static String |
CONTAINER_BLJ_DIR
Docker container blj dir: "/app/biolockj"
|
static String |
CONTAINER_ID_KEY |
static String |
DEFAULT_DOCKER_MAPPER |
static String |
DEFAULT_IMAGE_NAME
A light-weight docker image to use.
|
static String |
DEFAULT_IMAGE_OWNER |
static String |
DEFAULT_IMAGE_TAG |
static String |
DOCKER_BLJ_MOUNT_DIR
Docker container root user EFS directory: /mnt/efs
|
static String |
DOCKER_DB_DIR
Docker container root user DB directory: /mnt/efs/db
|
static String |
DOCKER_DEFAULT_DB_DIR
Docker container root user DB directory: /mnt/efs/db
|
static String |
DOCKER_HUB_USER
Config String property: "docker.imageOwner"Docker Hub URL: https://hub.docker.com By default the "biolockj" user is used to pull the standard modules, but advanced users can deploy their own versions of these modules and add new modules in their own Docker Hub account. |
static String |
DOCKER_IMG
Config String property: "docker.imageName" |
static String |
DOCKER_IMG_VERSION
Config String property: "docker.imageTag" |
static String |
DOCKER_MOUNT_SOCK
Config Boolean property: "docker.mountSock" |
static String |
DOCKER_PIPELINE_DIR
All containers mount "internal.pipelineDir" to the container volume: /mnt/efs/output
|
static String |
DOCKER_USER
Docker container default $USER: "root"
|
static String |
PURE_DOCKER_PIPELINE_DIR
When running in pure docker to do the initial setup, use this pipelines dir: "/workspace/pipelines"
|
static String |
ROOT_HOME
Docker container root user $HOME directory: /root
|
(package private) static String |
SAVE_CONTAINER_ON_EXIT
Config Boolean property: "docker.saveContainerOnExit" |
(package private) static String |
SPAWN_DOCKER_CONTAINER
Name of the bash script function used to generate a new Docker container: "spawnDockerContainer"
|
Constructor and Description |
---|
DockerUtil() |
Modifier and Type | Method and Description |
---|---|
static List<String> |
buildSpawnDockerContainerFunction(BioModule module,
String startedFlag)
Build the "spawnDockerContainer" method, which takes container name, in/out port, and optionally script
path parameters.
|
static void |
checkDependencies(BioModule module) |
static File |
containerizePath(File file)
|
static String |
containerizePath(String path)
If running in docker mode, convert this path to the form that can be used inside the docker container.
|
static File |
deContainerizePath(File innerFile)
|
static String |
deContainerizePath(String innerPath)
If running in docker mode, convert this path to the form that can be used on the host machine.
|
static Long |
downloadDB(String[] args,
String label)
Download a database for a Docker container
|
static String |
getContainerId()
Deprecated.
|
static String |
getDockerImage(BioModule module)
Return the name of the Docker image needed for the given module.
|
static File |
getDockerVolumePath(String path,
String containerPath)
Get Docker file path through mapped volume
|
static String |
getHostName() |
static String |
getMainDockerImage() |
static DockerMountMapper |
getMapper(boolean initAsNeeded)
Intended for diagnostic purposes only.
|
static String |
getVersionAsTag()
Get the docker image tag that represents the current BioLockJ version.
|
static boolean |
inAwsEnv()
Return TRUE if running in AWS (based on Config props).
|
static boolean |
inDockerEnv()
Check runtime env for /.dockerenv
|
static boolean |
isLocalImage(BioModule module,
String image) |
static ArrayList<String> |
listProps()
Let modules see property names.
|
static void |
main(String[] args)
Even outside of a BioLockJ instance, access the containerize() and decontainerze() methods.
|
static void |
makeMapper()
As version v1.3.18, the logic to do this mapping is not part of the DockerUtil class.
|
static void |
registerProps()
Register properties with the Properties class for API access.
|
static void |
touchDockerInfo()
Save a file with info about the current docker container.
|
static boolean |
workerContainerStopped(File mainStarted,
File workerScript) |
public static final String AWS_EC2_HOME
public static final String DOCKER_BLJ_MOUNT_DIR
public static final String DOCKER_DB_DIR
public static final String DOCKER_DEFAULT_DB_DIR
public static final String DOCKER_PIPELINE_DIR
public static final String PURE_DOCKER_PIPELINE_DIR
public static final String DOCKER_USER
public static final String ROOT_HOME
public static final String CONTAINER_BLJ_DIR
public static final String DOCKER_IMG_VERSION
Config
String property: "docker.imageTag" public static final String DOCKER_MOUNT_SOCK
Config
Boolean property: "docker.mountSock" static final String SAVE_CONTAINER_ON_EXIT
Config
Boolean property: "docker.saveContainerOnExit"static final String SPAWN_DOCKER_CONTAINER
public static final String DOCKER_IMG
Config
String property: "docker.imageName" public static final String DOCKER_HUB_USER
Config
String property: "docker.imageOwner"public static final String CONTAINER_ID_KEY
public static final String DEFAULT_DOCKER_MAPPER
public static final String DEFAULT_IMAGE_OWNER
public static final String DEFAULT_IMAGE_NAME
public static final String DEFAULT_IMAGE_TAG
public static List<String> buildSpawnDockerContainerFunction(BioModule module, String startedFlag) throws ConfigException, DockerVolCreationException
module
- BioModuleConfigNotFoundException
- If required Config
properties are undefinedConfigViolationException
- If "exe.docker" property name does not start with
prefix "exe."ConfigFormatException
- If "docker.saveContainerOnExit" property value is not set as a boolean
"Y" or "N"ConfigPathException
- If mounted Docker volumes are not found on host or container file-systemDockerVolCreationException
SpecialPropertiesException
ConfigException
public static boolean workerContainerStopped(File mainStarted, File workerScript)
public static Long downloadDB(String[] args, String label)
args
- Terminal command + argslabel
- Log file identifier for subprocesspublic static String getDockerImage(BioModule module) throws ConfigNotFoundException
module
- BioModuleConfigNotFoundException
- if Docker image version is undefinedpublic static String getMainDockerImage()
public static File getDockerVolumePath(String path, String containerPath)
path
- Config
file or directory pathcontainerPath
- Local container pathpublic static String getVersionAsTag()
public static boolean inAwsEnv()
public static boolean inDockerEnv()
public static void touchDockerInfo() throws DockerVolCreationException
DockerVolCreationException
public static String containerizePath(String path) throws DockerVolCreationException
path
- DockerVolCreationException
public static File containerizePath(File file) throws DockerVolCreationException
file
- DockerVolCreationException
public static String deContainerizePath(String innerPath) throws DockerVolCreationException
innerPath
- DockerVolCreationException
public static File deContainerizePath(File innerFile) throws DockerVolCreationException
innerFile
- DockerVolCreationException
public static void main(String[] args) throws DockerVolumeException
args
- DockerVolCreationException
DockerVolumeException
@Deprecated public static String getContainerId() throws IOException, DockerVolCreationException
public static String getHostName()
public static void checkDependencies(BioModule module) throws BioLockJException, InterruptedException, IOException
public static boolean isLocalImage(BioModule module, String image) throws SpecialPropertiesException, InterruptedException
public static void registerProps() throws API_Exception
API_Exception
public static DockerMountMapper getMapper(boolean initAsNeeded) throws DockerVolCreationException
initAsNeeded
- DockerVolCreationException
public static void makeMapper() throws RuntimeParamException
RuntimeParamException