A volume is a specially-designated directory within one or more containers that bypasses the Union File System. Using a volume means mounting an absolute path on a host (also called a node) to a path on a container, thereby achieving sharing between hosts and containers.
There are two ways to define a volume:
- Specify the Volume parameter on either the Create Component Template page or the App Designer page of the CCE console
- Run the docker run command with the -v option
For example, to mount the /src/webapp directory on a host to the /opt/webapp directory on the frontend container, run the following command:
docker run -d -P --name frontend -v /src/webapp:/opt/webapp frontend