<!-- source: https://deepwiki.com/MervinPraison/PraisonAI/9.1-docker-deployment -->

# Docker Deployment

- docker/Dockerfile
- docker/Dockerfile.chat
- docker/Dockerfile.dev
- docker/Dockerfile.ui
- docker/README.md
- src/praisonai-agents/pyproject.toml
- src/praisonai-agents/uv.lock
- src/praisonai/praisonai.rb
- src/praisonai/praisonai/cli/main.py
- src/praisonai/praisonai/deploy.py
- src/praisonai/praisonai/version.py
- src/praisonai/pyproject.toml
- src/praisonai/uv.lock

This document covers Docker-based deployment options for PraisonAI, including containerized services, multi-service orchestration, and cloud deployment capabilities. The system provides multiple Docker configurations for different use cases including API services, web interfaces, and development environments.

For information about cloud-specific deployment strategies, see [Cloud Deployment](/MervinPraison/PraisonAI/8.2-presets-and-defaults). For setting up development environments, see [Development Environment](/MervinPraison/PraisonAI/8.3-environment-variables).

## Docker Architecture Overview

PraisonAI provides four distinct Docker service configurations, each built on `python:3.11-slim` base image and using standardized directory management via `/root/.praison`. The deployment architecture separates concerns between API, UI, Chat, and Development services while maintaining consistent configuration patterns.

### Docker Service Architecture

```

```

Sources: [docker/Dockerfile1-47](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/Dockerfile#L1-L47) [docker/Dockerfile.ui1-33](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/Dockerfile.ui#L1-L33) [docker/Dockerfile.chat1-33](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/Dockerfile.chat#L1-L33) [docker/Dockerfile.dev1-47](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/Dockerfile.dev#L1-L47) [docker/README.md1-50](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/README.md?plain=1#L1-L50)

The system uses four Dockerfiles with standardized patterns:

- Dockerfile - API service using Flask + Gunicorn on port 8080
- Dockerfile.ui - Chainlit UI on port 8082 with praisonai[ui] and praisonai[crewai]
- Dockerfile.chat - Chat interface on port 8083 with embedchain[github,youtube]
- Dockerfile.dev - Development environment with Jupyter, pytest, and mkdocs

All containers share:

- Base: FROM python:3.11-slim docker/Dockerfile 1
- System deps: gcc, python3-dev, curl, git docker/Dockerfile 6-11
- Directory: RUN mkdir -p /root/.praison docker/Dockerfile 14
- Version: praisonai>=4.4.11 (UI/Chat/Dev) or latest (API)

Sources: [docker/Dockerfile1-47](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/Dockerfile#L1-L47) [docker/Dockerfile.ui1-33](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/Dockerfile.ui#L1-L33) [docker/Dockerfile.chat1-33](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/Dockerfile.chat#L1-L33) [docker/Dockerfile.dev1-47](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/Dockerfile.dev#L1-L47)

## Available Docker Services

The system provides five distinct Docker configurations, each optimized for specific deployment scenarios:

### API Service Configuration (Dockerfile)

The API service creates a minimal Flask application if `api.py` doesn't exist, providing a health check endpoint. The Dockerfile includes logic at [docker/Dockerfile33-43](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/Dockerfile#L33-L43) to generate a default API:

```

```

The service runs on port 8080 using Gunicorn: `CMD ["gunicorn", "-b", "0.0.0.0:8080", "api:app"]` [docker/Dockerfile46](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/Dockerfile#L46-L46)

### UI and Chat Service Configuration

Both UI and Chat services use the Chainlit framework with environment-specific ports:

**UI Service (Dockerfile.ui)**:

- Install: praisonai_tools , praisonai>=4.4.11 , praisonai[ui] , praisonai[crewai] docker/Dockerfile.ui 17-21
- Command: CMD ["praisonai", "ui"] docker/Dockerfile.ui 33
- Port: 8082 (configured via docker-compose)

**Chat Service (Dockerfile.chat)**:

- Install: praisonai_tools , praisonai>=4.4.11 , praisonai[chat] , embedchain[github,youtube] docker/Dockerfile.chat 17-21
- Command: CMD ["praisonai", "chat"] docker/Dockerfile.chat 33
- Port: 8083 (configured via docker-compose)

### Development Service Configuration (Dockerfile.dev)

The development image includes additional system dependencies for audio support and development tools:

System packages: `portaudio19-dev, python3-pyaudio, vim, nano` [docker/Dockerfile.dev9-10](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/Dockerfile.dev#L9-L10)

Python packages include full feature set:

- praisonai[ui] , praisonai[chat] , praisonai[realtime] , praisonai[code] docker/Dockerfile.dev 24-27
- embedchain[github,youtube] docker/Dockerfile.dev 28
- jupyter, jupyterlab, notebook docker/Dockerfile.dev 29-31
- pytest, pytest-asyncio docker/Dockerfile.dev 32-33
- mkdocs, mkdocs-material docker/Dockerfile.dev 34-35

Sources: [docker/Dockerfile33-46](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/Dockerfile#L33-L46) [docker/Dockerfile.ui17-33](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/Dockerfile.ui#L17-L33) [docker/Dockerfile.chat17-33](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/Dockerfile.chat#L17-L33) [docker/Dockerfile.dev9-35](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/Dockerfile.dev#L9-L35)

## Directory Management Solution

The Docker deployment implements a comprehensive directory management solution that consolidates all PraisonAI configuration files in a single location to prevent root directory clutter.

### Environment Variables Configuration

The system uses four key environment variables for directory management, set in all Dockerfiles:

- PRAISON_CONFIG_DIR=/root/.praison - Main configuration directory for PraisonAI
- CHAINLIT_CONFIG_DIR=/root/.praison - Chainlit configuration location
- CHAINLIT_DB_DIR=/root/.praison - Database storage location for Chainlit
- DOCKER_CONTAINER=true - Container detection flag

These are explicitly set in:

- docker/Dockerfile 29-30 for API service
- docker/Dockerfile.ui 27-30 for UI service
- docker/Dockerfile.chat 27-30 for Chat service
- docker/Dockerfile.dev 41-44 for Dev environment

```

```

Sources: [docker/Dockerfile14-30](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/Dockerfile#L14-L30) [docker/Dockerfile.ui14-30](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/Dockerfile.ui#L14-L30) [docker/Dockerfile.chat14-30](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/Dockerfile.chat#L14-L30) [docker/Dockerfile.dev18-44](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/Dockerfile.dev#L18-L44) [docker/README.md60-74](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/README.md?plain=1#L60-L74)

## Multi-Service Orchestration

The Docker Compose configuration enables simultaneous deployment of multiple PraisonAI services with coordinated networking and shared environment variables.

### Service Dependencies and Health Checks

```

```

Sources: [docker/README.md114-119](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/README.md?plain=1#L114-L119) [docker/README.md78-99](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/README.md?plain=1#L78-L99)

## Cloud Deployment with CloudDeployer

The `CloudDeployer` class in [src/praisonai/praisonai/deploy.py6-186](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/deploy.py#L6-L186) provides automated Google Cloud Platform deployment capabilities with Docker container orchestration. The class is instantiated with `__init__()` at line 18, which loads environment variables and sets configuration.

### CloudDeployer Workflow

The `CloudDeployer` class [src/praisonai/praisonai/deploy.py6](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/deploy.py#L6-L6) orchestrates Google Cloud Platform deployment through `run_commands()` method [src/praisonai/praisonai/deploy.py98](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/deploy.py#L98-L98):

```

```

### CloudDeployer File Generation

The `CloudDeployer` class generates deployment files programmatically before building and pushing to GCP.

**create_dockerfile()** [src/praisonai/praisonai/deploy.py36-63](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/deploy.py#L36-L63):

```

```

Generated Dockerfile contains:

- Base: python:3.11-slim
- Working directory: /app
- Dependencies: flask praisonai==4.4.11 gunicorn markdown line 60
- Exposed port: 8080
- Command: gunicorn -b 0.0.0.0:8080 api:app

**create_api_file()** [src/praisonai/praisonai/deploy.py64-91](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/deploy.py#L64-L91):

```

```

Generated API structure:

- Flask app on root path ( / ) line 84
- Loads agents.yaml configuration line 82
- Returns markdown-rendered HTML output

**set_environment_variables()** [src/praisonai/praisonai/deploy.py92-97](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/deploy.py#L92-L97):

```

```

Environment variables with fallback defaults:

- OPENAI_MODEL_NAME : defaults to "gpt-4o-mini"
- OPENAI_API_KEY : defaults to "Enter your API key"
- OPENAI_API_BASE : defaults to "https://api.openai.com/v1"

Sources: [src/praisonai/praisonai/deploy.py36-97](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/deploy.py#L36-L97)

## Package Dependencies and Versioning

The Docker configurations maintain consistent package versioning across all service types:

### Core Dependencies Matrix

### Package Installation Sequence

```

```

Sources: [docker/Dockerfile6-23](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/Dockerfile#L6-L23) [docker/Dockerfile.ui6-21](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/Dockerfile.ui#L6-L21) [docker/Dockerfile.chat6-21](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/Dockerfile.chat#L6-L21) [docker/Dockerfile.dev6-35](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/Dockerfile.dev#L6-L35)

## Security and Production Considerations

The Docker deployment implements several security and production-ready features:

### Security Configuration

- Minimal base image : Uses python:3.11-slim to reduce attack surface
- System dependency cleanup : Removes package lists with rm -rf /var/lib/apt/lists/*
- Environment variable-based configuration : Avoids hardcoded secrets
- Health check endpoints : Enables container orchestration monitoring
- Volume mounting : Separates data persistence from container lifecycle

### Production Deployment Features

The system supports production-grade deployment patterns:

- Resource limits : Configurable memory and CPU constraints
- Restart policies : unless-stopped for automatic recovery
- Load balancing : Multiple service instances for high availability
- Persistent storage : Volume mounting for data retention
- Service discovery : Network isolation and inter-service communication

Sources: [docker/README.md130-135](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/README.md?plain=1#L130-L135) [docker/README.md225-263](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/README.md?plain=1#L225-L263)
