mailrust runs in a container as well as on a server directly. The image is one static program on Alpine; everything you keep (the database, the key, settings and mail bodies) lives in the /data volume.
With Docker Compose
curl -fsSL https://mailrust.com/docker/compose.yaml -o compose.yaml
docker compose up -d
docker compose logs mailrust
The log prints the first-run link: open it, create the administrator and tell mailrust the address it is reachable at, as in First run.
By default the container listens on 127.0.0.1:8420: point your web server at it, as in HTTPS and proxies. MAILRUST_TRUSTED_PROXIES: private is already set, so mailrust sees your visitors' addresses through the Docker network.
HTTPS by itself
On a server with nothing else on ports 80 and 443, the container can get its own Let's Encrypt certificate. In compose.yaml, uncomment the two port lines and set the domain:
ports:
- "443:8443"
- "80:8080"
environment:
MAILRUST_DOMAIN: mail.example.com
MAILRUST_ACME_EMAIL: you@example.com
Inside the container mailrust uses ports 8443 and 8080, so it runs without root. Point the domain's A record at the server first.
Without Compose
docker build -t mailrust https://mailrust.com/docker/Dockerfile
docker run -d --name mailrust --restart unless-stopped \
-p 127.0.0.1:8420:8420 -v mailrust-data:/data mailrust
docker logs mailrust
How the image is built
The build downloads the latest release from mailrust.com and checks it before use: the release manifest must carry mailrust's signature and the file must match its checksum. A build that fails the check stops. The Dockerfile is short and readable: mailrust.com/docker/Dockerfile.
Updates
Build the image again and recreate the container. The data stays in the volume, and a new version upgrades the database itself, after taking a copy.
docker compose build --pull && docker compose up -d
mailrust update is for installs without Docker: inside a container, update the image instead.
Commands
Commands run inside the container, as the user the data belongs to:
docker compose exec mailrust mailrust setup-link
docker compose exec -e MAILRUST_USER=anna -e MAILRUST_PASS='a long new password' mailrust mailrust passwd
docker compose exec mailrust mailrust license
Backups
Copy the volume, or the backups mailrust takes itself every day inside it (/data/backups). See Backups.