Dify Deployment Walkthrough: Full Workflow with Docker, MySQL, and Model Integration

Complete route and key decision points for local Dify deployment on Windows with Docker.
Based on a Bilibili creator's tutorial, this article restates the full process of locally deploying Dify on Windows via Docker, supplementing key decision points and pitfalls. It explains why local Docker deployment is chosen—direct access to local MySQL and VM services, avoiding intranet penetration hassles of the online version; details the logic of installing MySQL 8 on the Windows host and alternatives; emphasizes configuration points for Dify connecting to MySQL, especially that the host address in Docker network cannot be localhost. Additionally, it outlines Dify's five core application types (Chat Assistant, Text Generation, Agent, Chatflow, Workflow) and their differences, gives model integration advice (prioritize paid APIs; local Ollama small models are limited but large-parameter models can be enterprise alternatives), and covers application publishing and intranet penetration for public access.
Dify is a popular AI application development platform today, allowing users without deep engineering backgrounds to quickly build chat assistants, text generation apps, Agent intelligences, and workflow applications. But many beginners get stuck at the first step: how do you get Dify running? This deployment tutorial from a Bilibili creator provides a clear Windows + Docker route. This article restates the process while supplementing key decision points and details that are easy to stumble on.
Why Choose Local Docker Deployment
The creator explicitly mentions that Dify has three usage modes: the official online version, source code deployment, and Docker-based local deployment. The online version works out of the box, but when your AI application needs to access the local machine's database or local environment, you have to do intranet penetration to expose the local IP to the public network, which actually increases configuration costs.
The advantage of local Docker deployment is that Dify runs in the Docker network and can directly communicate with MySQL on the local Windows host, as well as connect to services in VMware virtual machines. This means the applications you build can seamlessly read and write local data, and the debugging chain is shorter. The creator also reminds that for production environments, it is recommended to deploy to the company intranet yourself for easy internal application calls.

Docker Network and Host Communication: Docker containers by default run in an independent virtual network, and localhost inside the container points to the container itself, not the Windows host. Therefore, when the Dify container needs to access MySQL on the host, you cannot use localhost or 127.0.0.1; instead, use the special domain name for the host in the Docker network host.docker.internal (supported by default in Docker Desktop for Windows), or directly use the host's LAN IP. Understanding this is key to avoiding pitfalls in subsequent database configuration.
Logic of Installing MySQL 8 on Windows
The tutorial dedicates a section to installing MySQL 8 on Windows for a direct reason: AI applications built in Dify later need to interact with the database, reading data and writing results. Installing MySQL on the Windows host allows Dify in Docker to access it over the network.
The creator also provides alternatives: MySQL can be deployed based on Docker or placed in a VMware virtual machine, and Dify's Docker network can connect to either. This gives users flexibility to choose based on their existing environment, without being tied to one installation method.

Changes in MySQL 8 Authentication Plugin: MySQL 8 uses caching_sha2_password as the default authentication plugin, while some older clients or drivers may still rely on mysql_native_password. If Dify encounters authentication failure when connecting to MySQL, you can execute ALTER USER 'username'@'%' IDENTIFIED WITH mysql_native_password BY 'password'; in MySQL for the corresponding user and refresh privileges. Additionally, ensure MySQL allows remote connections (modify bind-address and authorize users to access from any host), otherwise Docker containers cannot connect.
Key Configuration Points for Dify Connecting to MySQL
After deploying Dify and MySQL, the key step is to let Dify recognize your database. The tutorial lists "Dify connecting to MySQL configuration" separately because all subsequent AI applications involving data interaction depend on this connection. The configuration itself is not complicated, but you need to accurately fill in the host address, port, account password, and database name, especially noting that the host address in the Docker network cannot directly be localhost.
Five Core Application Types and Workflow Nodes
Dify offers five types when creating an application: Chat Assistant, Text Generation, Agent Intelligence, Chatflow, and Workflow. The creator points out the difference in one sentence: Chat Assistant and Text Generation are basic interactions; Agent Intelligence can call tools to complete multi-step instructions, such as first crawling a webpage and then analyzing it; Chatflow and Workflow both belong to workflows, the former supports conversational interaction, while the latter is one-time input and output.
Workflows are composed of nodes, and the tutorial will explain common nodes one by one with over a dozen cases. The creator emphasizes that these nodes almost cover most of the nodes provided on the Dify official website, and after learning, you can handle most building scenarios.

Difference Between Agent Intelligence and Workflow: Agent Intelligence is based on the reasoning ability of large models and can autonomously decide which tools to call (such as search, calculation, API), suitable for open-ended, multi-step tasks; while workflows (Chatflow/Workflow) have developers pre-arrange the node order, with a determined execution path, suitable for scenarios with fixed processes and needing precise control. The two can be combined—embedding Agent nodes in workflows to balance flexibility and controllability.
Model Integration: Paid API or Local Ollama
Integrating large models is an unavoidable step. The creator recommends prioritizing paid APIs such as DeepSeekAd, ChatGPT, or using free tokens provided by Baidu Wenxin Yiyan and Alibaba Tongyi Qianwen. He did the math: recharging ten yuan for DeepSeek can last a long time, with actual consumption less than one yuan.
Local Ollama models are not the first choice because local small models usually have unsatisfactory results. But if the machine performance is sufficient, or the enterprise has a clustered Ollama deployment, downloading large-parameter models (such as DeepSeek's open-source large model, which can be over 400 GB in size) can also be integrated into Dify to build enterprise-level applications. The tutorial will specifically demonstrate the case of Dify associating with local Ollama models at the end.

Positioning and Integration of Ollama: Ollama is a local large model running tool that supports one-click download and running of open-source models like Llama and DeepSeek. When integrating Ollama in Dify, you need to fill in the API address of the Ollama service in the model provider settings (default is http://host.docker.internal:11434), and ensure Ollama allows cross-origin requests (set environment variable OLLAMA_HOST=0.0.0.0). Local models require no network or API fees, but inference speed and performance depend on hardware configuration, suitable for scenarios with high data privacy requirements or needing offline operation.
Application Publishing: From Local to Public Network
Built applications are not limited to internal use within Dify. The tutorial covers the application publishing step: you can generate a public website link for others to access, or embed it into your own website or third-party platforms. Public network publishing also involves intranet penetration, which is a necessary step for local deployment to become externally available.
The entire course revolves around "deployment—connection—usage—publishing". For beginners, following along once will get the basic Dify chain running.
Related articles

Prompt Engineering for Beginners: From Writing Prompts to Engineering Thinking
Starting from the essence and four functions of prompts, this article systematically explains the six-step process, four success criteria, learning value, and practical limitations of prompt engineering to help you build a complete understanding.

Anthropic Launches Nasdaq IPO: AI Giant's Listing and Risk Disclosures
Anthropic officially launches its Nasdaq IPO under ticker ANT, with market valuation expected to potentially exceed SpaceX's record. The prospectus devotes nearly 100 pages to AI risks, while first-half revenue grew over 14x but net losses widened sharply, reigniting the AI bubble debate.

Rust cURL Clone Uses 4,832 unsafe Blocks—Is the Memory Safety Myth Broken?
A Rust cURL clone uses 4,832 unsafe keywords, challenging Rust's memory safety narrative. We analyze what unsafe really means, compare Fil-C, and examine rewrite motives.