This guide explains how to deploy the CME Equity Options Pricer using Docker.
- Docker Desktop installed and running
- Docker Compose (included with Docker Desktop)
- At least 2GB of available RAM
- Internet connection for downloading dependencies
Windows (PowerShell):
# Build and run the application
.\docker-run.ps1 run
# Or start with Docker Compose
.\docker-run.ps1 composeLinux/macOS (Bash):
# Make the script executable
chmod +x docker-run.sh
# Build and run the application
./docker-run.sh run
# Or start with Docker Compose
./docker-run.sh composeBuild the image:
docker build -t cme-equity-options-pricer:latest .Run the container:
docker run -d \
--name cme-equity-options-pricer \
-p 8501:8501 \
--restart unless-stopped \
cme-equity-options-pricer:latestDevelopment environment:
docker-compose up -dProduction environment:
docker-compose -f docker-compose.prod.yml up -dOnce running, access the application at:
- Local: http://localhost:8501
- Network: http://YOUR_IP:8501
Windows PowerShell:
.\docker-run.ps1 build # Build the image
.\docker-run.ps1 run # Build and run
.\docker-run.ps1 logs # View logs
.\docker-run.ps1 stop # Stop services
.\docker-run.ps1 restart # Restart services
.\docker-run.ps1 cleanup # Clean up resourcesLinux/macOS Bash:
./docker-run.sh build # Build the image
./docker-run.sh run # Build and run
./docker-run.sh logs # View logs
./docker-run.sh stop # Stop services
./docker-run.sh restart # Restart services
./docker-run.sh cleanup # Clean up resourcesView logs:
docker logs -f cme-equity-options-pricerStop the container:
docker stop cme-equity-options-pricer
docker rm cme-equity-options-pricerStop Docker Compose services:
docker-compose downYou can customize the application by setting environment variables:
docker run -d \
--name cme-equity-options-pricer \
-p 8501:8501 \
-e STREAMLIT_SERVER_PORT=8501 \
-e ALPHA_VANTAGE_API_KEY=your_api_key \
-e FRED_API_KEY=your_fred_key \
cme-equity-options-pricer:latestTo persist data between container restarts:
docker run -d \
--name cme-equity-options-pricer \
-p 8501:8501 \
-v $(pwd)/data:/app/data \
-v $(pwd)/logs:/app/logs \
cme-equity-options-pricer:latestThe Dockerfile uses a multi-stage build process:
- Builder stage: Installs dependencies with build tools
- Production stage: Creates a lightweight runtime image
- Runs as non-root user (
streamlit) - Minimal base image (Python slim)
- No unnecessary packages in production image
- Health checks enabled
- Layer caching for faster rebuilds
- Optimized dependency installation
- Resource limits configured
- Efficient file copying
- Check Docker is running:
docker info - Check port availability:
netstat -an | grep 8501 - View container logs:
docker logs cme-equity-options-pricer
- Check application logs:
docker logs -f cme-equity-options-pricer - Ensure all required environment variables are set
- Verify network connectivity for API calls
- Clear Docker cache:
docker system prune -a - Ensure sufficient disk space
- Check internet connectivity for package downloads
- Increase Docker memory allocation (Docker Desktop settings)
- Adjust resource limits in docker-compose.yml
- Monitor container resources:
docker stats cme-equity-options-pricer
The docker-compose.prod.yml includes additional services:
- Nginx: Reverse proxy with SSL support
- Redis: Caching layer for improved performance
- PostgreSQL: Optional database for data persistence
# Start production environment
docker-compose -f docker-compose.prod.yml up -d
# Monitor services
docker-compose -f docker-compose.prod.yml psFor HTTPS in production:
- Place SSL certificates in
./nginx/ssl/ - Update
./nginx/nginx.confwith SSL configuration - Restart services
Monitor resource usage:
# View resource consumption
docker stats
# View container health
docker ps# Stop and remove containers
docker-compose down
# Remove images
docker rmi cme-equity-options-pricer:latest
# Clean up all unused resources
docker system prune -a# Remove only stopped containers
docker container prune
# Remove only unused images
docker image prune
# Remove only unused volumes
docker volume pruneIf you encounter issues:
- Check the troubleshooting section above
- Review container logs for error messages
- Ensure all prerequisites are met
- Verify network connectivity and firewall settings