Deploy with Docker Compose
Before installing Dify, make sure your machine meets the following minimum system requirements:
CPU >= 2 Core
RAM >= 4 GiB
Operating System | Software | Explanation |
---|---|---|
macOS 10.14 or later |
Docker Desktop |
Set the Docker virtual machine (VM) to use a minimum of 2 virtual CPUs (vCPUs) and 8 GB of initial memory. Otherwise, the installation may fail. For more information, please refer to the Docker Desktop installation guide for Mac. |
Linux platforms |
Docker 19.03 or later Docker Compose 1.28 or later |
Please refer to the Docker installation guide and the Docker Compose installation guide for more information on how to install Docker and Docker Compose, respectively. |
Windows with WSL 2 enabled |
Docker Desktop |
We recommend storing the source code and other data that is bound to Linux containers in the Linux file system rather than the Windows file system. For more information, please refer to the Docker Desktop installation guide for using the WSL 2 backend on Windows. |
[!IMPORTANT]
Dify 0.6.12 has introduced significant enhancements to Docker Compose deployment, designed to improve your setup and update experience. For more information, read the README.md.
Clone the Dify source code to your local machine:
-
Navigate to the Docker directory in the Dify source code
-
Copy the environment configuration file
-
Start the Docker containers
Choose the appropriate command to start the containers based on the Docker Compose version on your system. You can use the
$ docker compose version
command to check the version, and refer to the Docker documentation for more information:-
If you have Docker Compose V2, use the following command:
-
If you have Docker Compose V1, use the following command:
-
After executing the command, you should see output similar to the following, showing the status and port mappings of all containers:
Finally, check if all containers are running successfully:
This includes 3 core services: api / worker / web
, and 6 dependent components: weaviate / db / redis / nginx / ssrf_proxy / sandbox
.
With these steps, you should be able to install Dify successfully.
Enter the docker directory of the dify source code and execute the following commands:
-
If the
.env.example
file has been updated, be sure to modify your local.env
file accordingly. -
Check and modify the configuration items in the
.env
file as needed to ensure they match your actual environment. You may need to add any new variables from.env.example
to your.env
file, and update any values that have changed.
Access administrator initialization page to set up the admin account:
Dify web interface address:
Edit the environment variable values in your .env
file directly. Then, restart Dify with:
The full set of annotated environment variables along can be found under docker/.env.example.