Introduction
This guide explains how to install and run Dify on your local machine using Docker. By following these steps, you will clone the Dify source code, configure the environment, and start the necessary containers.
Prerequisites
- Docker installed on your system (View guide)
- Git installed (use:
sudo apt install git
) - Basic familiarity with command-line usage
We’ve partnered with UpCloud to offer you €25 in free credits—get started with cloud servers and storage for self-hosting and more!
Cloning the Dify Source Code
Clone the Dify repository from GitHub to your local machine. Replace 0.15.3
with the latest version if applicable.
# Clone the repository
git clone https://github.com/langgenius/dify.git --branch 0.15.3
Navigating to the Docker Directory
Change to the Docker directory within the cloned repository:
cd dify/docker
Configuring the Environment
Copy the example environment configuration file to create a working .env
file:
cp .env.example .env
Starting the Docker Containers
Start the necessary Docker containers using the appropriate command based on your Docker Compose version.
Check Docker Compose Version
To determine your Docker Compose version, run:
docker compose version
Start Containers with Docker Compose V2
If using Docker Compose V2, start the containers with:
docker compose up -d
Start Containers with Docker Compose V1
If using Docker Compose V1, use:
docker-compose up -d
Check the status
docker compose ps
The output should list the core services and their statuses:
NAME IMAGE COMMAND SERVICE STATUS PORTS
docker-api-1 langgenius/dify-api:0.6.13 "/bin/bash /entrypoi…" api Up 5001/tcp
docker-db-1 postgres:15-alpine "docker-entrypoint.s…" db Up (healthy) 5432/tcp
docker-nginx-1 nginx:latest "sh -c 'cp /docker-e…" nginx Up 0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp
...
Dify runs three core services (api
, worker
, and web
) and six dependent components (weaviate
, db
, redis
, nginx
, ssrf_proxy
, and sandbox
).
Conclusion
After completing these steps, Dify should be running successfully on your local machine. You can now start using it for your development and testing needs.
Leave a Reply