mirror of
https://github.com/jpetazzo/container.training.git
synced 2026-07-16 03:19:18 +00:00
🔧 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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user