Skip to main content
TrailBase provides official Docker images for easy containerized deployment. The images are multi-arch and support both x86_64 and ARM64 architectures.

Docker Image

The official TrailBase Docker image is available on Docker Hub:
Image details:
  • Base: Alpine Linux 3.22
  • User: Runs as unprivileged trailbase user
  • Architectures: linux/amd64, linux/arm64
  • Entrypoint: Uses tini for proper signal handling
  • Health check: Built-in health check on /api/healthcheck

Quick Start

Run TrailBase in a Docker container with persistent storage:
Docker will create the traildepot directory with root ownership if it doesn’t exist. The TrailBase container runs as an unprivileged user and will encounter permission errors. Always create the directory first with proper permissions.

Docker Compose

The recommended way to run TrailBase with Docker is using docker-compose:
1

Create docker-compose.yml

Create a docker-compose.yml file based on the official template:
docker-compose.yml
2

Create data directory

Create the data directory with proper permissions:
3

Start the service

4

View logs

On first start, the logs will contain the admin credentials.
The docker-compose file uses environment variables for easy customization. Set PORT to change the exposed port and DATA_DIR to change the data directory location.

Configuration Options

Environment Variables

Configure TrailBase through environment variables in docker-compose:
docker-compose.yml

Custom Command

Override the default command for advanced configuration:
docker-compose.yml

Volume Mounts

Mount additional volumes for static files or WASM components:
docker-compose.yml

Kubernetes Deployment

For Kubernetes deployments, TrailBase provides example manifests:
1

Create PersistentVolumeClaim

trailbase-storage.yml
2

Create Deployment

trailbase-deployment.yml
3

Create Service

trailbase-service.yml
4

Deploy to cluster

The Kubernetes deployment uses a Recreate strategy to ensure only one pod writes to the database at a time, as SQLite does not support concurrent writes from multiple processes.

Podman Support

TrailBase images also work with Podman:
For persistent storage with Podman:

Building Custom Images

To build a custom TrailBase Docker image:
1

Clone the repository

2

Build the image

The Dockerfile uses multi-stage builds:
  • builder: Compiles Rust code with MUSL for static linking
  • auth-ui-builder: Builds auth UI WASM component
  • binary-builder: Builds the main TrailBase binary
  • image: Final Alpine-based image with minimal dependencies
3

Run your custom image

Health Checks

The Docker image includes a built-in health check:
Use this in docker-compose:
docker-compose.yml
Or override it:

Production Recommendations

Avoid using :latest in production. Pin to specific versions:
Define CPU and memory limits:
Configure log rotation:
Store sensitive configuration in Docker secrets:

Troubleshooting

Permission Denied Errors

If you see “Permission denied” errors in logs:

Container Won’t Start

Check logs for errors:

Database Locked

SQLite databases can’t be accessed by multiple containers:

Next Steps

Production Setup

Production checklist, security hardening, and monitoring

Configuration

Detailed configuration options and environment variables