Always persist caddy data directory/volume (#1986)

* Always persist caddy data directory/volume

This defines the volume as external in order to avoid the problem that `docker-compose down` removes the volume.
This makes sure the volume is not accidentally removed.

This is important, because of the reasons the Readme describes further above. That volume must not be treated as temporary.

See https://docs.docker.com/compose/compose-file/compose-file-v3/#external
Ref https://forums.docker.com/t/why-docker-compose-down-deletes-my-volume-how-to-define-volume-as-external/67433
This commit is contained in:
rugk 2021-07-10 02:32:08 +02:00 committed by GitHub
parent e8eeb9e2c6
commit 03b61a4095
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -131,5 +131,8 @@ services:
volumes:
caddy_data:
external: true
caddy_config:
```
Defining the data volume as [`external`](https://docs.docker.com/compose/compose-file/compose-file-v3/#external) makes sure `docker-compose down` does not delete the volume. You may need to create it manually using `docker volume create [project-name]_caddy_data`.