🔧 Fix Tomcat volume example

New Tomcat image (version 9) doesn't load any example webapp
by default, but ships with examples in webapps.dist.

Let's use this as an opportunity to demonstrate how to populate
empty volumes from container directories.

Closes #561.
This commit is contained in:
Jerome Petazzoni
2021-08-05 12:55:22 +02:00
parent b508360227
commit 71423233bd

View File

@@ -159,6 +159,24 @@ Volumes are not anchored to a specific path.
---
## Populating volumes
* When an empty volume is mounted on a non-empty directory, the directory is copied to the volume.
* This makes it easy to "promote" a normal directory to a volume.
* Non-empty volumes are always mounted as-is.
Let's populate the webapps volume with the webapps.dist directory from the Tomcat image.
````bash
$ docker run -v webapps:/usr/local/tomcat/webapps.dist tomcat true
```
Note: running `true` will cause the container to exit successfully once the `webapps.dist` directory has been copied to the `webapps` volume, instead of starting tomcat.
---
## Using our named volumes
* Volumes are used with the `-v` option.