Thanks to visit codestin.com
Credit goes to rustmailer.com

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 rustmailer/rustmailer:latest

Option 2: Build the Image Yourself​

Make sure you have the project cloned and compiled:

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

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

# Step 3: Build Docker image using provided script
cd /home/user/rustmailer/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 \
rustmailer/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).
example

Pull and run the latest RustMailer container for a fast and easy hands-on experience

docker run -d --name rustmailer -p 15630:15630 -p 16630:16630 -e RUSTMAILER_ROOT_DIR=/data -v /sourcecode/rustmailer_data/:/data rustmailer/rustmailer:latest

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_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.

View Logs​

If your container fails to start or you want to troubleshoot its running status, use the following command to view the container logs:

sudo docker logs rustmailer

πŸ›‘ Stopping the Container​

To stop and remove the container:

docker stop rustmailer
docker rm rustmailer

🧩 Additional Notes​

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