Docker Compose is the recommended way to deploy Dify for most users.
git clone https://github.com/langgenius/dify.git
cd dify/docker
# Copy the example environment file
cp .env.example .env
# Edit configuration if needed
nano .env
Key environment variables to configure:
# Application
CONSOLE_API_URL=https://your-domain.com
CONSOLE_WEB_URL=https://your-domain.com
SERVICE_API_URL=https://your-domain.com/api
# Database
DB_USERNAME=dify
DB_PASSWORD=your-secure-password
DB_DATABASE=dify
# Redis
REDIS_PASSWORD=your-secure-password
# LLM Provider Keys
OPENAI_API_KEY=sk-...
# Start all services
docker compose up -d
# View logs
docker compose logs -f
Open your browser and navigate to http://localhost:3000.
Create your admin account and configure your first LLM provider.
| Service | Container Name | Port | Description |
|---|---|---|---|
| API | dify-api | 5001 | Backend API server |
| Web | dify-web | 3000 | Frontend web UI |
| DB | dify-db | 5432 | PostgreSQL database |
| Redis | dify-redis | 6379 | Redis cache |
| Worker | dify-worker | - | Background worker |
| Sandbox | dify-sandbox | 8194 | Code execution sandbox |
Data is persisted in Docker volumes:
dify-db-data - PostgreSQL databasedify-redis-data - Redis datadify-storage - File storage# Pull latest changes
git pull
# Stop services
docker compose down
# Start with new version
docker compose up -d
docker compose ps
# All services
docker compose logs -f
# Specific service
docker compose logs -f dify-api
docker compose restart
For production deployments:
💼 Professional Services: Need expert help with your Dify Docker deployment? We offer consulting, training, and support. Contact our team →