mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
Use bind mounts in sample config (#2035)
* Update docker-compose.yml * Update faq.md * chore: remove volume reference * fix: remove trailing whitespace * chore: add more verbose description Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com> * gzip switch added Not all tar versions do support auto detection of compression. Co-authored-by: Frederic Werner <20406381+wernerfred@users.noreply.github.com> Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com> Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
This commit is contained in:
parent
5becce8064
commit
b6b0948095
|
@ -17,16 +17,11 @@ services:
|
|||
- "587:587" # ESMTP (explicit TLS => STARTTLS)
|
||||
- "993:993" # IMAP4 (implicit TLS)
|
||||
volumes:
|
||||
- maildata:/var/mail
|
||||
- mailstate:/var/mail-state
|
||||
- maillogs:/var/log/mail
|
||||
- ./data/maildata:/var/mail
|
||||
- ./data/mailstate:/var/mail-state
|
||||
- ./data/maillogs:/var/log/mail
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- ./config/:/tmp/docker-mailserver/
|
||||
restart: always
|
||||
stop_grace_period: 1m
|
||||
cap_add: [ "NET_ADMIN", "SYS_PTRACE" ]
|
||||
|
||||
volumes:
|
||||
maildata:
|
||||
mailstate:
|
||||
maillogs:
|
||||
|
|
|
@ -54,16 +54,30 @@ Please do not use `CRLF`.
|
|||
|
||||
### What about backups?
|
||||
|
||||
#### Bind mounts (default)
|
||||
|
||||
From the location of your `docker-compose.yml`, create a compressed archive of your `./config` and `./data` folders:
|
||||
|
||||
```bash
|
||||
tar --gzip -cf "backup-$(date +%F).tar.gz" config data
|
||||
```
|
||||
|
||||
Then to restore `./config` and `./data` folders from your backup file:
|
||||
|
||||
```bash
|
||||
tar --gzip -xf backup-date.tar.gz
|
||||
```
|
||||
|
||||
#### Volumes
|
||||
|
||||
Assuming that you use `docker-compose` and data volumes, you can backup the configuration, emails and logs like this:
|
||||
|
||||
```sh
|
||||
# create backup
|
||||
docker run --rm -ti \
|
||||
-v maildata:/var/mail \
|
||||
-v mailstate:/var/mail-state \
|
||||
-v maillogs:/var/logs/mail \
|
||||
docker run --rm -it \
|
||||
-v "$PWD/config":/tmp/docker-mailserver \
|
||||
-v /backup/mail:/backup \
|
||||
--volumes-from mailserver \
|
||||
alpine:latest \
|
||||
tar czf "/backup/mail-$(date +%F).tar.gz" /var/mail /var/mail-state /var/logs/mail /tmp/docker-mailserver
|
||||
|
||||
|
|
Loading…
Reference in a new issue