Docker Configuration
Docker is the recommended way to run AI Proxy Self-hosted. By using the ready-made container image, you eliminate the complexity of .NET installation, dependency management, and environment configuration. Containerization ensures consistent operation across different environments - from local laptop with Docker Desktop, through production servers, to orchestration platforms like Kubernetes or Azure Container Instances.
In this guide you will find ready-to-use docker-compose configurations for three main scenarios: basic installation with PEM certificate, configuration with password-protected PFX certificate, and advanced deployment with Azure Application Insights integration for monitoring. Each configuration contains detailed parameter explanations and startup instructions.
If you are deploying AI Proxy for the first time, we recommend starting with Variant 1 (PEM certificate) - it's the simplest and works on all platforms.
Requirements
- Docker Desktop or Docker Engine
- SSL/TLS certificate (PEM or PFX)
aiconfiguration.jsonfile
Production: certificate from a trusted CA. Development: self-signed (examples at the end of the page).
Docker Compose Configurations
Three configuration variants for different scenarios:
Variant 1: PEM Certificate (docker-compose-basic-pem.yml)
Basic configuration for PEM format certificate (Let's Encrypt, OpenSSL).
name: aiproxy_containers
services:
ai-proxy:
image: webconbps/aiproxy:1.0.0.235
container_name: ai-proxy
restart: unless-stopped
ports:
- "5298:8080"
- "7033:8081"
environment:
- ASPNETCORE_ENVIRONMENT=Production
- AppConfiguration__SelfHosted__Certificate__Path=/app/https/certificate.pem
- Logging__LogLevel__Default=Information
- Logging__LogLevel__Microsoft=Warning
volumes:
- ./certificates/certificate.pem:/app/https/certificate.pem:ro
- ./aiconfiguration.json:/app/aiconfiguration.json:ro
Variant 2: PFX Certificate (docker-compose-basic-pfx.yml)
Configuration for PFX certificate with password (popular format in Windows).
name: aiproxy_containers
services:
ai-proxy:
image: webconbps/aiproxy:1.0.0.235
container_name: ai-proxy
restart: unless-stopped
ports:
- "5298:8080"
- "7033:8081"
environment:
- ASPNETCORE_ENVIRONMENT=Production
- AppConfiguration__SelfHosted__Certificate__Path=/app/https/certificate.pfx
- AppConfiguration__SelfHosted__Certificate__Password=<hasło>
- Logging__LogLevel__Default=Information
- Logging__LogLevel__Microsoft=Warning
volumes:
- ./certificates/certificate.pfx:/app/https/certificate.pfx:ro
- ./aiconfiguration.json:/app/aiconfiguration.json:ro
Replace <hasło> with the actual PFX certificate password. For production, consider using Docker secrets instead of hardcoding the password.
Variant 3: Application Insights (docker-compose-applicationinsights.yml)
Configuration with Azure Application Insights integration for performance and log monitoring.
name: aiproxy_containers
services:
ai-proxy:
image: webconbps/aiproxy:1.0.0.235
container_name: ai-proxy
restart: unless-stopped
ports:
- "5298:8080"
- "7033:8081"
environment:
- ASPNETCORE_ENVIRONMENT=Production
- AppConfiguration__SelfHosted__Certificate__Path=/app/https/certificate.pem
- 'AppConfiguration__ApplicationInsightsConnectionString=<connection-string>'
- Logging__LogLevel__Default=Information
- Logging__LogLevel__Microsoft=Warning
- Serilog__Using__0=Serilog.Sinks.Console
- Serilog__Using__1=Serilog.Sinks.ApplicationInsights
- Serilog__WriteTo__0__Name=Console
- Serilog__WriteTo__1__Name=ApplicationInsights
- 'Serilog__WriteTo__1__Args__connectionString=<connection-string>'
- Serilog__WriteTo__1__Args__telemetryConverter=Serilog.Sinks.ApplicationInsights.TelemetryConverters.TraceTelemetryConverter, Serilog.Sinks.ApplicationInsights
volumes:
- ./certificates/certificate.pem:/app/https/certificate.pem:ro
- ./aiconfiguration.json:/app/aiconfiguration.json:ro
Replace <connection-string> with the actual Connection String from Azure Portal (Application Insights > Properties).
How to run AI Proxy - step by step
1. File preparation
Create the certificates directory and place your certificate in it:
mkdir certificates
# Copy your certificate to ./certificates/certificate.pem (or .pfx)
Make sure the aiconfiguration.json file is in the same directory as the docker-compose file.
2. Container startup
docker-compose up -d
3. Status check
# Check if the container is running
docker-compose ps
# View logs
docker-compose logs -f ai-proxy
4. Shutdown
docker-compose down
Generating test certificates
For development environments you can generate a self-signed certificate.
PEM Certificate (OpenSSL)
# Generate certificate
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes
# Combine into one file
cat key.pem cert.pem > certificate.pem
# Move to certificates directory
mv certificate.pem ./certificates/
PFX Certificate (PowerShell)
# Generate certificate
$cert = New-SelfSignedCertificate -DnsName "localhost" -CertStoreLocation "cert:\CurrentUser\My" -NotAfter (Get-Date).AddYears(1)
# Export to PFX
$password = ConvertTo-SecureString -String "YourPassword123" -Force -AsPlainText
Export-PfxCertificate -Cert $cert -FilePath ".\certificates\certificate.pfx" -Password $password
Troubleshooting
Container won't start
# Check logs
docker-compose logs ai-proxy
# Check status
docker ps -a
Common causes:
- Missing certificate in
./certificates/directory - Invalid
aiconfiguration.jsonfile - Occupied ports 5298 or 7033
Ports occupied
If ports are occupied, change them in the docker-compose.yml file:
ports:
- "5299:8080" # Change first port
- "7034:8081" # Change first port
Then check which ports are occupied:
netstat -ano | findstr :7033
Certificate problems
# Check if certificate is valid
openssl x509 -in ./certificates/certificate.pem -text -noout
# Check if container sees the file
docker exec ai-proxy ls -l /app/https/