Deploy Cognee locally or on a server with Docker Compose. The includedDocumentation Index
Fetch the complete documentation index at: https://docs.cognee.ai/llms.txt
Use this file to discover all available pages before exploring further.
docker-compose.yml uses profiles so you can start only the services you need.
Prerequisites
- Docker and Docker Compose v2+
- Git
Quick Start
.env and set your LLM API key:
http://localhost:8000. Interactive docs at http://localhost:8000/docs.
Service Profiles
Each optional service is gated behind a profile. Use--profile to activate one or more:
| Profile | Service | Port(s) | Purpose |
|---|---|---|---|
| (none) | cognee | 8000, 5678 | Core API server |
mcp | cognee-mcp | 8000, 5678 | MCP server for IDE integrations |
ui | frontend | 3000 | Experimental web UI |
neo4j | neo4j | 7474, 7687 | Neo4j graph database |
chromadb | chromadb | 3002 | ChromaDB vector database |
postgres | postgres | 5432 | PostgreSQL + pgvector |
redis | redis | 6379 | Redis caching |
Data Persistence
The compose file mounts your localcognee/ source directory and .env file into the container. Named volumes persist database data between restarts:
| Service | Volume |
|---|---|
postgres | postgres_data |
chromadb | .chromadb_data/ (local dir) |
redis | redis_data |
docker-compose.yml.
Environment Variables
Thecognee container reads configuration from .env at startup. Key variables:
| Variable | Default | Description |
|---|---|---|
LLM_API_KEY | (required) | API key for your LLM provider |
LLM_MODEL | openai/gpt-4o-mini | LLM model to use |
DB_PROVIDER | sqlite | Relational DB: sqlite or postgres |
GRAPH_DATABASE_PROVIDER | kuzu | Graph DB: kuzu, neo4j, etc. |
VECTOR_DB_PROVIDER | lancedb | Vector DB: lancedb, chromadb, pgvector, etc. |
CORS_ALLOWED_ORIGINS | * | Restrict to specific domains in production |
REQUIRE_AUTHENTICATION | false | Enable JWT auth for the API |
COGNEE_SKIP_CONNECTION_TEST | false | Skip LLM/embedding connectivity checks on startup. Accepts true, 1, or yes. |
chunk_size | 1500 | Max tokens per chunk during cognify (see Chunkers) |
chunk_overlap | 10 | Overlap between chunks in words (only affects LangchainChunker) |
Common Setups
Cognee + PostgreSQL
Cognee + PostgreSQL
PostgreSQL with pgvector is a good production choice for the relational database.Add to your Start both services:
.env:Cognee + PostgreSQL + Neo4j
Cognee + PostgreSQL + Neo4j
For production deployments with a dedicated graph database:Add to your Start the stack:Neo4j browser is available at
.env:http://localhost:7474.Cognee + ChromaDB
Cognee + ChromaDB
Use ChromaDB as the vector store:Add to your Start:
.env:Cognee with MCP Server
Cognee with MCP Server
Run the MCP server alongside the API:The MCP server uses SSE transport on port
8000 (separate container). Configure your IDE to point to http://localhost:8000/sse.Stopping and Cleaning Up
Additional Information
Adding optional extras to the Docker image
Adding optional extras to the Docker image
The default Docker image includes a fixed set of extras from the repository This same pattern works for other extras such as
Dockerfile. If you need features behind another optional dependency, add the matching --extra <name> flag to both uv sync lines in the Dockerfile, then rebuild the image.For a table of available extras and common combinations, see Installation.
For a table of supported file types and their loaders, see Loaders.Example: adding the docs extrascraping, redis, tracing, monitoring, or docling.Rebuild after updating the Dockerfile:Fixing 'Connection refused' startup errors with PostgreSQL
Fixing 'Connection refused' startup errors with PostgreSQL
When Cognee starts before PostgreSQL finishes initializing, the first API call triggers LLM/embedding connectivity checks (This delays the
setup_and_check_environment) and may hit the database before it accepts connections, producing [Errno 111] Connection refused or [Errno 99] Cannot assign requested address.Recommended fix — add a healthcheck and depends_on condition to your docker-compose.yml:cognee container until PostgreSQL passes its health check.Alternative fix — bypass the connectivity check:If you cannot modify the compose file (e.g. third-party orchestration), set COGNEE_SKIP_CONNECTION_TEST=true to skip the LLM/embedding startup probe entirely. The check is only performed once (on first run), so the trade-off is that misconfigured endpoints are not caught until the first real request.Enabling office documents and advanced PDF loaders
Enabling office documents and advanced PDF loaders
To use UnstructuredLoader for Once rebuilt, the loaders activate automatically for supported file types with no code changes required.
.docx, .pptx, .xlsx, .epub, and similar formats, add --extra docs as shown above and rebuild the image.That same docs extra also enables AdvancedPdfLoader. For layout-aware or OCR-based PDF extraction, you additionally need poppler-utils and tesseract-ocr in the runtime stage of your Dockerfile (the second FROM python:3.12-slim-bookworm block):Need help?
Join our community for Docker deployment support.