Docker Mail Server 构建实践
目标:构建基于docker-compose的邮件系统步骤:1. 配置域名 @ 记录指向邮件服务器ip2. 建立目录:/data0/Server/Settings/docker-mailserver3. 获取需要的脚本cd /data0/Server/Settings/docker-mailserver# if you're using :edge as the image tagwget http
·
目标:
构建基于docker-compose的邮件系统
步骤:
1. 以阿里控制台为例,在域名管理
- 添加A记录,配置域名 mail.xxx.com
- 添加MX记录,配置域名 @ 记录指向邮件服务器ip
- 开通邮件推送服务,在邮件推送控制台建发信域名,发信地址
2. 建立目录: /data0/Server/Settings/docker-mailserver
3. 获取需要的脚本
cd /data0/Server/Settings/docker-mailserver
wget https://github.com/docker-mailserver/docker-mailserver/blob/master/compose.yaml
wget https://github.com/docker-mailserver/docker-mailserver/blob/master/mailserver.env
# if you're using :edge as the image tag
wget https://github.com/docker-mailserver/docker-mailserver/blob/master/setup.sh
chmod a+x ./setup.sh
# and make yourself familiar with the script
./setup.sh help
4. 修改mailserver.env,启用pop3
# 1 => Enables POP3 service
# empty => disables POP3
ENABLE_POP3=1
ENABLE_CLAMAV=0
5. 修改 docker-compose.yml 内容为合适路径(注意目录权限)
version: '3.8'
services:
mailserver:
image: docker.io/mailserver/docker-mailserver:latest
hostname: mail
domainname: mkplay.xyz
container_name: mailserver
env_file: mailserver.env
# To avoid conflicts with yaml base-60 float, DO NOT remove the quotation marks.
# More information about the mailserver ports:
# https://docker-mailserver.github.io/docker-mailserver/edge/config/security/understanding-the-ports/
ports:
- "25:25" # SMTP (explicit TLS => STARTTLS)
- "110:110" # POP3
- "143:143" # IMAP4 (explicit TLS => STARTTLS)
- "465:465" # ESMTP (implicit TLS)
- "587:587" # ESMTP (explicit TLS => STARTTLS)
- "993:993" # IMAP4 (implicit TLS)
volumes:
- "/data0/Server/Db/mail:/var/mail"
- "/data0/Server/Var/mail-state:/var/mail-state"
- "/data0/Server/Logs/mail:/var/log/mail"
- "/etc/localtime:/etc/localtime:ro"
- "./config/:/tmp/docker-mailserver/"
restart: always
stop_grace_period: 1m
cap_add: [ "NET_ADMIN", "SYS_PTRACE" ]
6. 试运行
docker-compose up -d mailserver
./setup.sh email add <user@domain> [<password>]
./setup.sh email update <user@domain> [<password>]
./setup.sh alias add postmaster@<domain> <user@domain>
./setup.sh config dkim
7. 完成
资料:
更多推荐
所有评论(0)