jeboehm / docker-mailserver

Docker Mailserver based on the famous ISPMail guide
MIT License
368 stars 97 forks source link

Try to persistence volume but encounter error #75

Closed aaronchn closed 4 years ago

aaronchn commented 4 years ago

To Reproduce In docker-compose.yml, Change

mda:
...
  volumes:
    - data-mail:/var/vmail

To

mda:
...
  volumes:
    - /opt/somewhere/maildata:/var/vmail

Then bin/production.sh up -d

Login the webmail UI with browser will seen a warring "Server error: STATUS: Internal error occurred"

To see the log use bin/production.sh logs -f mda, will seen many error:

imap(bob@example.com)<416><h61/Ej+VmLesFQAG>: Error: mkdir(/var/vmail/example.com/bob/Maildir) failed: Permission denied (euid=5000(vmail) egid=5000(vmail) missing +w perm: /var/vmail, dir owned by 0:0 mode=0755)
imap(bob@example.com)<416><h61/Ej+VmLesFQAG>: Error: mkdir(/var/vmail/example.com/bob/Maildir) failed: Permission denied (euid=5000(vmail) egid=5000(vmail) missing +w perm: /var/vmail, dir owned by 0:0 mode=0755)
imap(bob@example.com)<416><h61/Ej+VmLesFQAG>: Error: Mailbox INBOX: Failed to autocreate mailbox: Internal error occurred. Refer to server log for more information. 
imap(bob@example.com)<416><h61/Ej+VmLesFQAG>: Error: mkdir(/var/vmail/example.com/bob/Maildir) failed: Permission denied (euid=5000(vmail) egid=5000(vmail) missing +w perm: /var/vmail, dir owned by 0:0 mode=0755)

This seems to be a permissions-related issue. If you try to persist the volume of other services, you may also encounter this problem.

Thanks

jeboehm commented 4 years ago

Hi @aaronchn Docker containers will inherit file permissions from bind mounted volumes. You'll need to change the owner and group of /opt/somewhere/maildata.

BTW: I tried to answer your email, but live.com is rejecting my mails...