Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:Langgenius Dify Docker Compose Profiles

From Leeroopedia
Knowledge Sources Dify
Domains DevOps, Deployment, VectorDB, RAG
Last Updated 2026-02-12 00:00 GMT

Overview

Concrete tool for selecting which vector database and metadata database containers are launched during a Dify Docker deployment, provided by the Docker Compose profile mechanism in docker/docker-compose.yaml.

Description

The docker-compose.yaml file defines multiple vector database services, each annotated with a profiles key. Docker Compose only starts services whose profile matches a value in the COMPOSE_PROFILES environment variable. The COMPOSE_PROFILES variable is automatically derived from two user-facing settings:

# In .env / .env.example (line 1336):
COMPOSE_PROFILES=${VECTOR_STORE:-weaviate},${DB_TYPE:-postgresql}

Each vector database service declares its profile. For example, at line 177 of the compose file, the VECTOR_STORE variable defaults to weaviate:

VECTOR_STORE: ${VECTOR_STORE:-weaviate}

The corresponding Weaviate service definition:

weaviate:
  image: semitechnologies/weaviate:1.27.0
  profiles:
    - weaviate
  restart: always
  volumes:
    - ./volumes/weaviate:/var/lib/weaviate
  environment:
    PERSISTENCE_DATA_PATH: ${WEAVIATE_PERSISTENCE_DATA_PATH:-/var/lib/weaviate}
    AUTHENTICATION_APIKEY_ENABLED: ${WEAVIATE_AUTHENTICATION_APIKEY_ENABLED:-true}
    AUTHENTICATION_APIKEY_ALLOWED_KEYS: ${WEAVIATE_AUTHENTICATION_APIKEY_ALLOWED_KEYS:-WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih}

For multi-container vector stores like Milvus, all related services share the same profile:

etcd:
  image: quay.io/coreos/etcd:v3.5.5
  profiles:
    - milvus

minio:
  image: minio/minio:RELEASE.2023-03-20T20-16-18Z
  profiles:
    - milvus

milvus-standalone:
  image: milvusdb/milvus:v2.6.3
  profiles:
    - milvus
  depends_on:
    - etcd
    - minio

Usage

Use this implementation when deploying Dify and choosing which vector database to run. Set VECTOR_STORE in the .env file before running docker compose up -d.

Code Reference

Source Location: docker/docker-compose.yaml (line 177 for VECTOR_STORE, profile definitions throughout), docker/.env.example (line 1336 for COMPOSE_PROFILES)

Signature:

# Set vector store in .env
VECTOR_STORE=qdrant

# COMPOSE_PROFILES is automatically computed:
# COMPOSE_PROFILES=${VECTOR_STORE:-weaviate},${DB_TYPE:-postgresql}
# Result: COMPOSE_PROFILES=qdrant,postgresql

Import statement: Not applicable (Docker Compose configuration).

I/O Contract

Inputs

Parameter Type Required Default Description
VECTOR_STORE string No weaviate Vector database selection; one of: weaviate, qdrant, milvus, pgvector, pgvecto-rs, chroma, opensearch, oceanbase, seekdb, elasticsearch, oracle, opengauss, myscale, couchbase, vastbase, matrixone, iris
DB_TYPE string No postgresql Metadata database type; one of: postgresql, mysql
COMPOSE_PROFILES string No ${VECTOR_STORE},${DB_TYPE} Derived comma-separated list of Docker Compose profiles to activate

Outputs

Output Type Description
Active containers Docker services Only services matching the selected profiles are started
Inactive containers Docker services Services with non-matching profiles are not created or started

Usage Examples

Default deployment (Weaviate + PostgreSQL):

# .env contains:
# VECTOR_STORE=weaviate
# DB_TYPE=postgresql
# Resulting COMPOSE_PROFILES=weaviate,postgresql

docker compose up -d
# Starts: api, worker, worker_beat, web, nginx, redis, ssrf_proxy,
#         sandbox, plugin_daemon, db_postgres, weaviate

Switch to Qdrant:

# Edit .env:
VECTOR_STORE=qdrant

docker compose up -d
# Starts: core services + db_postgres + qdrant
# Weaviate container is NOT started

Switch to Milvus (multi-container):

# Edit .env:
VECTOR_STORE=milvus

docker compose up -d
# Starts: core services + db_postgres + etcd + minio + milvus-standalone

Use MySQL instead of PostgreSQL:

# Edit .env:
DB_TYPE=mysql
VECTOR_STORE=pgvector

docker compose up -d
# COMPOSE_PROFILES=pgvector,mysql
# Starts: core services + db_mysql + pgvector
# db_postgres is NOT started

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment