Skip to main content

Docker

This document explains how to install and run RustMailer using Docker.
It assumes you have Docker installed on your system.

πŸ“¦ Docker Image​

You can either use the official image published to Docker Hub or build it manually.

Option 1: Use Prebuilt Image from Docker Hub​

# Pull the latest tagged image from Docker Hub
docker pull billydong/rustmailer:<version>

# Replace <version> with the desired version, e.g.
docker pull billydong/rustmailer:1.2.3

Option 2: Build the Image Yourself​

Make sure you have the project cloned and compiled:

# Step 1: Build frontend assets
cd /home/user/rustmailer-core/web
pnpm install
pnpm run build

# Step 2: Compile Rust binary
cd /home/user/rustmailer-core
cargo build --release

# Step 3: Build Docker image using provided script
cd /home/user/rustmailer-core/docker
./build.sh

πŸš€ Running the Container​

Run the container using the following command:

docker run -d \
--name rustmailer \
-p 15630:15630 \
-p 16630:16630 \
-v /path/to/your/data:/data \
--env-file /path/to/your/env.file \
billydong/rustmailer:<version>
  • Replace <version> with the image tag you want.
  • Replace /path/to/your/data with the actual directory where you want to persist data.
  • Replace /path/to/your/env.file with the actual path to your environment variable file (e.g., /home/user/rustmailer.env).

The environment variable options for the rustmailer container are detailed in the official documentation under Configuration Reference. Please refer to it for a complete list of supported variables.

Here's an example of an environment variable file (rustmailer.env):

RUSTMAILER_ROOT_DIR=/data/rustmailer_data
RUSTMAILER_HTTP_PORT=15630
RUSTMAILER_GRPC_ENABLED=true
RUSTMAILER_GRPC_PORT=16630
RUSTMAILER_BIND_IP="0.0.0.0"
RUSTMAILER_PUBLIC_URL="http://localhost:15630"
RUSTMAILER_LOG_TO_FILE=true

πŸ” Health Check​

RustMailer exposes a health check endpoint:

GET http://localhost:15630/api/status

This is used internally by Docker’s HEALTHCHECK, but can also be used for monitoring or debugging.

πŸ›‘ Stopping the Container​

To stop and remove the container:

docker stop rustmailer
docker rm rustmailer

🧩 Additional Notes​

  • The container runs as a non-root user (rmailer).
  • Data is persisted under /data inside the container.
  • Make sure your volume path is writable by Docker.