Container Volumes
CLI Tutorial: Container Volumes
Container volumes can be configured through environment topology settings or managed separately with direct CLI methods.
Volume Configuration Methods
The topology-based method uses the following parameters inside the appropriate docker section:
volumes— defines local container volumes.volumeMounts— configures mount points.volumesFrom— imports existing volumes from another node.
Define Local Volumes
Declare one or more persistent local-volume paths inside the Docker configuration:
... "docker": {
...
"volumes": [
"{local_volume}",
"{local_volume}"
]
}
Replace {local_volume} with the path where the volume should be created inside the container. Multiple volume paths can be supplied in the same list.
/my_volume_1 and /my_volume_2.
Configure Volume Mounts
Use volumeMounts to make data from another node or storage host available at a local path:
... "docker": {
...
"volumeMounts": {
"{local_path}": {
"sourcePath": "{remote_path}",
"sourceNodeId": "{node_ID}",
"readOnly": {true/false}
}
}
}
| Parameter | Description |
|---|---|
{local_path} | Folder path on the client node where the mounted content should appear. |
{remote_path} | Directory path on the remote source container. |
{node_ID} | Unique identifier of the source node. |
{true/false} | Defines read-only or read/write access. The default is false. |
Instead of sourceNodeId, the source can also be selected with:
sourceNodeGroup— uses the master node of the specified environment layer.sourceHost— uses the external IP address or custom domain of a storage server, including an external server.
Import Volumes from Another Node
Use volumesFrom to mount existing volumes from another node:
... "docker": {
...
"volumesFrom": [
{
"sourceNodeId": "{node_ID}",
"readOnly": {true/false},
"volumes": [
"{local_volume}",
"{local_volume}"
]
}
]
}
sourceNodeIdidentifies the node containing the source volumes.sourceNodeGroupcan be used instead to select the master node of a layer.readOnlycontrols read-only or read/write access and defaults tofalse.volumeslists the volumes to mount. If omitted, all available volumes are imported.
Direct Volume Management
The following CLI methods manage volumes without changing the remaining environment topology.
Add a Volume to One Container
~/jelastic/environment/control/addcontainervolume \
--envName {env_name} \
--nodeId {node_ID} \
--path {path}
Remove a Volume from One Container
~/jelastic/environment/control/removecontainervolume \
--envName {env_name} \
--nodeId {node_ID} \
--path {path}
Add a Volume to an Entire Layer
~/jelastic/environment/control/addcontainervolumebygroup \
--envName {env_name} \
--nodeGroup {node_group} \
--path {path}
Remove a Volume from an Entire Layer
~/jelastic/environment/control/removecontainervolumebygroup \
--envName {env_name} \
--nodeGroup {node_group} \
--path {path}
CLI Parameters
| Parameter | Description |
|---|---|
{env_name} | Name of the environment that should be modified. |
{node_ID} | Unique identifier of the individual container. |
{node_group} | Environment-layer identifier such as cp, bl, or storage. |
{path} | Local filesystem path of the volume directory. |
