Add absolute path docs

Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
This commit is contained in:
Ulysses Souza 2020-10-21 11:56:45 +02:00
parent 27f7949782
commit 853dd000d5
1 changed files with 31 additions and 1 deletions

View File

@ -149,7 +149,37 @@ secrets:
The nginx container will have secret1 mounted as `/run/secrets/mysecret1`, the db container will have secret2 mounted as `/run/secrets/mysecret2`
**Note that file paths are not allowed in the target**
A target can also be specified to set the name of the mounted file or by specifying an absolute path where to mount the secret file
```yaml
services:
nginx:
image: nginx
secrets:
- source: mysecret1
target: renamedsecret1.txt
db:
image: mysql
secrets:
- source: mysecret1
target: /mnt/dbmount/mysecretonmount1.txt
- source: mysecret2
target: /mnt/dbmount/mysecretonmount2.txt
secrets:
mysecret1:
file: ./my_secret1.txt
mysecret2:
file: ./my_secret2.txt
```
In this example the `nginx` service will have its secret mounted in `/run/secrets/renamedsecret1.txt` and `db` will have 2 files (`mysecretonmount1.txt` and `mysecretonmount2.txt`).
Both of them with be mounted in the same folder (`/mnt/dbmount/`).
**Note that absolute file paths are not allowed in the target**
**The target folder will be empty when mounting inside**
## Container Resources