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)
|
- "587:587" # ESMTP (explicit TLS => STARTTLS)
|
||||||
- "993:993" # IMAP4 (implicit TLS)
|
- "993:993" # IMAP4 (implicit TLS)
|
||||||
volumes:
|
volumes:
|
||||||
- maildata:/var/mail
|
- ./data/maildata:/var/mail
|
||||||
- mailstate:/var/mail-state
|
- ./data/mailstate:/var/mail-state
|
||||||
- maillogs:/var/log/mail
|
- ./data/maillogs:/var/log/mail
|
||||||
- /etc/localtime:/etc/localtime:ro
|
- /etc/localtime:/etc/localtime:ro
|
||||||
- ./config/:/tmp/docker-mailserver/
|
- ./config/:/tmp/docker-mailserver/
|
||||||
restart: always
|
restart: always
|
||||||
stop_grace_period: 1m
|
stop_grace_period: 1m
|
||||||
cap_add: [ "NET_ADMIN", "SYS_PTRACE" ]
|
cap_add: [ "NET_ADMIN", "SYS_PTRACE" ]
|
||||||
|
|
||||||
volumes:
|
|
||||||
maildata:
|
|
||||||
mailstate:
|
|
||||||
maillogs:
|
|
||||||
|
|
|
@ -54,16 +54,30 @@ Please do not use `CRLF`.
|
||||||
|
|
||||||
### What about backups?
|
### 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:
|
Assuming that you use `docker-compose` and data volumes, you can backup the configuration, emails and logs like this:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# create backup
|
# create backup
|
||||||
docker run --rm -ti \
|
docker run --rm -it \
|
||||||
-v maildata:/var/mail \
|
|
||||||
-v mailstate:/var/mail-state \
|
|
||||||
-v maillogs:/var/logs/mail \
|
|
||||||
-v "$PWD/config":/tmp/docker-mailserver \
|
-v "$PWD/config":/tmp/docker-mailserver \
|
||||||
-v /backup/mail:/backup \
|
-v /backup/mail:/backup \
|
||||||
|
--volumes-from mailserver \
|
||||||
alpine:latest \
|
alpine:latest \
|
||||||
tar czf "/backup/mail-$(date +%F).tar.gz" /var/mail /var/mail-state /var/logs/mail /tmp/docker-mailserver
|
tar czf "/backup/mail-$(date +%F).tar.gz" /var/mail /var/mail-state /var/logs/mail /tmp/docker-mailserver
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue