Docker Image
The official TrailBase Docker image is available on Docker Hub:- Base: Alpine Linux 3.22
- User: Runs as unprivileged
trailbaseuser - Architectures: linux/amd64, linux/arm64
- Entrypoint: Uses
tinifor proper signal handling - Health check: Built-in health check on
/api/healthcheck
Quick Start
Run TrailBase in a Docker container with persistent storage: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
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:Building Custom Images
To build a custom TrailBase Docker image:1
Clone the repository
2
Build the image
- 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:docker-compose.yml
Production Recommendations
Set resource limits
Set resource limits
Define CPU and memory limits:
Enable logging
Enable logging
Configure log rotation:
Use secrets for sensitive data
Use secrets for sensitive data
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