安装Postal邮件服务器遇Docker Compose错误:profiles选项不支持
解决Postal邮件服务器docker-compose.yml的profiles配置错误
报错核心原因:你的docker-compose.yml使用了3.9版本,但profiles配置项是在Compose文件格式3.10及以上版本才引入的,3.9版本不支持该选项,因此触发配置无效错误。
方案1:升级Compose文件版本
将配置文件开头的version: "3.9"改为version: "3.10"(或更高兼容版本,如3.11),修改后的完整配置如下:
version: "3.10" services: web: image: ghcr.io/postalserver/postal:2.1.4 command: postal web-server network_mode: host volumes: - /opt/postal/config:/config smtp: image: ghcr.io/postalserver/postal:2.1.4 command: postal smtp-server network_mode: host cap_add: - NET_BIND_SERVICE volumes: - /opt/postal/config:/config worker: image: ghcr.io/postalserver/postal:2.1.4 command: postal worker network_mode: host volumes: - /opt/postal/config:/config cron: image: ghcr.io/postalserver/postal:2.1.4 command: postal cron network_mode: host volumes: - /opt/postal/config:/config requeuer: image: ghcr.io/postalserver/postal:2.1.4 command: postal requeuer network_mode: host volumes: - /opt/postal/config:/config runner: profiles: ["tools"] image: ghcr.io/postalserver/postal:2.1.4 command: postal network_mode: host volumes: - /opt/postal/config:/config
修改后重新执行docker-compose up即可,此时profiles配置会被正常识别,可通过docker-compose --profile tools up启动包含runner服务的容器组。
方案2:移除profiles配置(保留3.9版本)
若不想升级Compose文件版本,可直接删除runner服务下的profiles: ["tools"]行,修改后的runner服务配置如下:
runner: image: ghcr.io/postalserver/postal:2.1.4 command: postal network_mode: host volumes: - /opt/postal/config:/config
修改后配置文件可正常加载,若需单独控制runner服务的启动:
- 启动所有服务(含runner):
docker-compose up -d - 启动除runner外的服务:
docker-compose up -d web smtp worker cron requeuer - 仅启动runner服务:
docker-compose up -d runner
内容的提问来源于stack exchange,提问作者dark-sqirrel
相关产品推荐
相关产品推荐

