-
-
Notifications
You must be signed in to change notification settings - Fork 101
Docker
Fabrizio Salmi edited this page May 12, 2026
·
1 revision
This guide covers building, deploying, and running CertMate in Docker — including multi-platform support for ARM and AMD64.
# Docker automatically selects the right architecture
docker run -d --name certmate \
--env-file .env \
-p 8000:8000 \
-v certmate_data:/app/data \
-v certmate_certificates:/app/certificates \
fabriziosalmi/certmate:latestdocker build -t certmate:latest .
docker run -d --name certmate \
--env-file .env \
-p 8000:8000 \
-v certmate_certificates:/app/certificates \
-v certmate_data:/app/data \
-v certmate_logs:/app/logs \
certmate:latestThe build process ensures no secrets are included in the image:
-
.dockerignoreexcludes all.envfiles and sensitive data - Environment variables are provided at runtime, not build time
- Only essential application files are included
- Images can be safely pushed to public registries
docker history certmate:latest
docker inspect certmate:latest | grep -i env
docker run --rm certmate:latest find / -name "*.env" 2>/dev/nullCreate a .env file on your host (not in the Docker image):
SECRET_KEY=your-super-secret-key-here
# SECRET_KEY_FILE=/run/secrets/secret_key # Alternative: takes precedence over SECRET_KEY
API_BEARER_TOKEN=your-api-bearer-token-here
# API_BEARER_TOKEN_FILE=/run/secrets/api_bearer_token # Alternative: takes precedence over API_BEARER_TOKEN
CLOUDFLARE_API_TOKEN=your-cloudflare-api-token
LOG_LEVEL=INFOdocker run -d --name certmate \
--env-file .env \
-p 8000:8000 \
-v certmate_certificates:/app/certificates \
-v certmate_data:/app/data \
-v certmate_logs:/app/logs \
certmate:latestdocker run -d --name certmate \
-e SECRET_KEY="your-secret-key" \
# -e SECRET_KEY_FILE="/run/secrets/secret_key" \ # Alternative: takes precedence over SECRET_KEY
-e API_BEARER_TOKEN="your-api-bearer-token" \
# -e API_BEARER_TOKEN_FILE="/run/secrets/api_bearer_token" \ # Alternative: takes precedence over API_BEARER_TOKEN
-e CLOUDFLARE_API_TOKEN="your-api-token" \
-p 8000:8000 \
-v certmate_certificates:/app/certificates \
-v certmate_data:/app/data \
certmate:latest| Variable | Required | Description |
|---|---|---|
SECRET_KEY |
No | Flask secret key for sessions (auto-generated if unset) |
SECRET_KEY_FILE |
No | Path to a file containing the Flask secret key (takes precedence over SECRET_KEY) |
API_BEARER_TOKEN |
No | Authentication token for API access (auto-generated if unset) |
API_BEARER_TOKEN_FILE |
No | Path to a file containing the API bearer token (takes precedence over API_BEARER_TOKEN) |
LOG_LEVEL |
No |
INFO (default), DEBUG, WARNING, ERROR
|
CLOUDFLARE_API_TOKEN |
No | Cloudflare DNS provider token |
AWS_ACCESS_KEY_ID |
No | AWS Route53 access key |
AWS_SECRET_ACCESS_KEY |
No | AWS Route53 secret key |
See the Installation Guide for the complete list.
version: '3.8'
services:
certmate:
image: fabriziosalmi/certmate:latest
container_name: certmate
ports:
- "8000:8000"
environment:
- SECRET_KEY=${SECRET_KEY:-}
# - SECRET_KEY_FILE=${SECRET_KEY_FILE:-} # Alternative: path to a file containing the secret key
- API_BEARER_TOKEN=${API_BEARER_TOKEN:-}
# - API_BEARER_TOKEN_FILE=${API_BEARER_TOKEN_FILE:-} # Alternative: path to a file containing the bearer token
- LOG_LEVEL=${LOG_LEVEL:-INFO}
volumes:
- certmate_certificates:/app/certificates
- certmate_data:/app/data
- certmate_logs:/app/logs
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
volumes:
certmate_certificates:
certmate_data:
certmate_logs:# Start with .env file in the same directory
docker-compose up -d
# Or specify a different env file
docker-compose --env-file /path/to/.env up -dCertMate supports multi-platform Docker images for both ARM and AMD64 architectures.
| Platform | Description | Common Use Cases |
|---|---|---|
linux/amd64 |
Intel/AMD 64-bit | Most cloud servers, desktops |
linux/arm64 |
ARM 64-bit | Apple Silicon, ARM cloud instances |
linux/arm/v7 |
ARM 32-bit v7 | Raspberry Pi 3+ |
linux/arm/v6 |
ARM 32-bit v6 | Raspberry Pi 1, Zero |
# Build for current platform only
./build-docker.sh
# Build for multiple platforms (ARM64 + AMD64)
./build-docker.sh -m
# Build and push to Docker Hub
./build-docker.sh -m -p -r YOUR_DOCKERHUB_USERNAME
# Dedicated multi-platform script
./build-multiplatform.sh -r USERNAME -v v1.0.0 -p
# Build for Raspberry Pi
./build-multiplatform.sh --platforms linux/arm/v7 -r USERNAME -p# Create and use buildx builder
docker buildx create --name certmate-builder --use
# Build for multiple platforms
docker buildx build --platform linux/amd64,linux/arm64 \
-t USERNAME/certmate:latest .
# Build and push
docker buildx build --platform linux/amd64,linux/arm64 \
-t USERNAME/certmate:latest --push .# Verify buildx support
docker buildx version
docker buildx inspect --bootstrap
# Enable QEMU emulation (if needed)
docker run --privileged --rm tonistiigi/binfmt --install all# Force AMD64 (e.g., on Apple Silicon for testing)
docker run --platform linux/amd64 --rm \
--env-file .env -p 8000:8000 certmate:latest
# Auto-detect (recommended)
docker run --rm --env-file .env -p 8000:8000 certmate:latest# Login
docker login
# Tag and push
docker build -t USERNAME/certmate:latest .
docker push USERNAME/certmate:latest
# With version tag
docker build -t USERNAME/certmate:v1.0.0 .
docker push USERNAME/certmate:v1.0.0Required secrets:
DOCKERHUB_USERNAMEDOCKERHUB_TOKEN
# Manual trigger with custom platforms
gh workflow run docker-multiplatform.yml \
-f platforms="linux/amd64,linux/arm64,linux/arm/v7" \
-f push_to_registry=true- Use secrets management: Docker secrets, Kubernetes secrets, or a secrets manager
- Enable TLS: Run behind a reverse proxy with TLS termination
- Monitor resources: Set CPU and memory limits
- Backup volumes: Regularly backup certificate and data volumes
- Update regularly: Keep the image updated with security patches
-
Use layer caching for faster builds:
docker buildx build --cache-from type=registry,ref=USERNAME/certmate:cache .
docker logs certmate
docker exec certmate envdocker logs certmate
docker exec certmate curl -v http://localhost:8000/healthdocker exec certmate ls -la /app/certificates
docker exec certmate ls -la /app/data| Error | Solution |
|---|---|
| "multiple platforms not supported for docker driver" | docker buildx create --name multiplatform --use |
| "exec format error" | docker run --privileged --rm tonistiigi/binfmt --install all |
| Slow non-native builds | Normal due to emulation; use GitHub Actions for production |
| Cannot load multi-platform to local Docker | Use --load with single platform for local testing |
Typical sizes per architecture:
- AMD64: ~200-300 MB
- ARM64: ~200-300 MB
- ARM v7: ~180-250 MB
CertMate · README · Releases · Report a bug · Request a feature
Getting started
Core configuration
Client certificates
Reference
Project