The first way to create Docker volume we’ll consider is to define it right during the environment creation (or when changing its topology). So, in order to setup your local container storage, the following parameters can be used for Docker-based environments whilst executing the appropriate CLI method:
- volumes - sets list of local volumes
- volumeMounts - allows to configure mount points
- volumesFrom - imports existing volumes from node on your account
Tip: This parameters can be used within your JPS manifests as well.
1. All of these parameters are to be declared within the appropriate docker section. For example, the first parameter can be set in the following way:
… "docker":{... "volumes": ["{local_volume}", "{local_volume}", ...]}

Here, {local_volume} is a placeholder for the path your local volume should be placed inside a container. You can specify multiple volumes at once using comma separator.
E.g., within the image above, we create environment with the jelastic/haproxy image inside and two local volumes attached, namely: /my_volume_1 and /my_volume_2.
2. The second volumeMounts parameter has the next syntaxis:
… "docker":{... "volumeMounts" : {"{local_path}" : {"sourcePath" : "{remote_path}", "sourceNodeId" : "{node_ID}", "readOnly" : {true/false}}, ...}}

The highlighted data should be changed to the appropriate values:- {local_path} - path to the folder within nodes of the specified environment layer the mounted content should be placed at
- {remote_path} - the required directory location at the remote container (i.e. address of source data)
- {node_ID} - unique identifier of the node your data will be mounted from
Note: Alternatively to the "sourceNodeId" parameter, you can also use:
As an example, using the command on image above, we’ve mounted data from the 111109 node of the used account.
3. With the last volumesFrom parameter, it’s possible to mount all the existing volumes from one node to another (i.e. copy them), e.g.:
… "docker":{... "volumesFrom":[{"sourceNodeId" : "{node_ID}", "readOnly" : {true/false}, "volumes" : ["{local_volume}", "{local_volume}", ...]}]}

Here:- {node_ID} - unique identifier of the node the data should be mounted from
Note: Alternatively, it is possible to use
"sourceNodeGroup" to define
environment layer, which master node will be used as a source for mount operation.
In such a way, using the command in the image above, we’ve added a new layer with two jelastic/tomcat8 Docker images and mounted the comprised volumes to the existing jelastic/haproxy node.