This guide provides a full Ansible playbook to deploy Mailpile with Docker Compose on Debian 10+, Ubuntu LTS, and RHEL 9+ compatible hosts.
- name: Deploy Mailpile
hosts: mailpile
become: true
vars:
app_root: /opt/mailpile
app_port: 8080
tasks:
- name: Install Docker on Debian/Ubuntu
apt:
name:
- docker.io
- docker-compose-plugin
state: present
update_cache: true
when: ansible_os_family == "Debian"
- name: Install Docker on RHEL family
dnf:
name:
- docker
- docker-compose-plugin
state: present
when: ansible_os_family == "RedHat"
- name: Enable and start Docker
service:
name: docker
state: started
enabled: true
- name: Create application directory
file:
path: "{{ app_root }}"
state: directory
mode: "0755"
- name: Write Docker Compose file
copy:
dest: "{{ app_root }}/docker-compose.yml"
mode: "0644"
content: |
services:
app:
image: mazzolino/mailpile:latest
restart: unless-stopped
ports:
- "{{ app_port }}:33411"
volumes:
- mailpile_data:/.mailpile
environment:
- MAILPILE_HTTP_HOST=0.0.0.0
- MAILPILE_HTTP_PORT=33411
volumes:
mailpile_data:
- name: Start application stack
command: docker compose up -d
args:
chdir: "{{ app_root }}"
## Notes
- ⚠️ **No official Docker image exists** - This playbook uses a community-maintained image (`mazzolino/mailpile`)
- Alternative community image: `florianpiesche/mailpile` or `florianpiesche/mailpile-multiuser`
- Mailpile v1 is legacy software - development is halted pending Python 3 rewrite
- Review container variables before production use
- Configure IMAP/SMTP connection settings in the Mailpile configuration
---
**Any questions?**
Feel free to contact us. Find all contact information on our [contact page](/contact).