Skip to main content

Using dorcha-gateway with Docker

We provide pre-built docker images for dorcha-gateway to support containerized deployments. After getting the artifact, you can use the following commands to set it up.

# Decompress
unzip dorcha-gateway-docker-image-tar-gz.zip

# Extract the compressed image
gunzip dorcha-gateway.tar.gz

# Load the image into Docker
docker load < dorcha-gateway.tar

# Verify the image is loaded
docker images | grep dorcha-gateway

Running the Pre-built Image

# Create necessary directories
mkdir -p config keys logs

# Create a configuration file
cp ../example-configs/config.http.example.json config/dorcha-gateway-config.json

# Run the container
docker run -d \
--name dorcha-gateway \
-p 3128:3128 \
-p 3129:3129 \
-v $(pwd)/config:/app/config:ro \
-v $(pwd)/keys:/app/keys \
-v $(pwd)/logs:/app/logs \
dorcha-gateway:latest

# Check health
curl http://localhost:3128/health

Using Docker Compose with Pre-built Images

Create a docker-compose.yml file:

services:
dorcha-gateway:
image: dorcha-gateway:latest
container_name: dorcha-gateway
ports:
- "3128:3128"
- "3129:3129"
volumes:
- ./config:/app/config:ro
- ./keys:/app/keys
- ./logs:/app/logs
environment:
- TZ=UTC
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3128/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s

Then run:

docker compose up -d

Performance Tuning

For production deployments:

  • Use resource limits, e.g --memory=512m --cpus=1.0
  • Enable logging rotation
  • Mount persistent volumes for logs and keys
  • Consider using Docker secrets for sensitive configuration