milvus local uri does not work #5688

Closed
opened 2026-02-21 18:12:11 -05:00 by yindo · 1 comment
Owner

Originally created by @zc277584121 on GitHub (Sep 19, 2024).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.8.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

git clone https://github.com/langgenius/dify.git
cd dify/docker

the environment configuration file

cp .env.example .env

Change the value VECTOR_STORE in the .env file

VECTOR_STORE=milvus

Change the Milvus configuration in the .env file

MILVUS_URI=http://127.0.0.1:19530

For the MILVUS_URI setting, 127.0.0.1 or localhost does not work. However, if I set the it as an external uri of the server e.g.http://172.16.70.6:19530, it works.

I tried to enter the api and worker container, and then tried to ping 127.0.0.1:19530, but it failed. This means that the two containers and the milvus standalone container do not share the same IP 127.0.0.1 . But when I change it to an external IP format, it worked, because every container can successfully ping the external IP.

I don't know much about network settings. I'm not sure if this is a bug, but it looks like a bug.

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @zc277584121 on GitHub (Sep 19, 2024). ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.8.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce ```shell git clone https://github.com/langgenius/dify.git ``` ```shell cd dify/docker ``` the environment configuration file ```shell cp .env.example .env ``` Change the value `VECTOR_STORE` in the `.env` file ```shell VECTOR_STORE=milvus ``` Change the Milvus configuration in the `.env` file ```shell MILVUS_URI=http://127.0.0.1:19530 ``` For the `MILVUS_URI` setting, `127.0.0.1` or `localhost` does not work. However, if I set the it as an external uri of the server e.g.`http://172.16.70.6:19530`, it works. I tried to enter the `api` and `worker` container, and then tried to ping 127.0.0.1:19530, but it failed. This means that the two containers and the milvus standalone container do not share the same IP 127.0.0.1 . But when I change it to an external IP format, it worked, because every container can successfully ping the external IP. I don't know much about network settings. I'm not sure if this is a bug, but it looks like a bug. ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 👻 feat:rag label 2026-02-21 18:12:11 -05:00
yindo closed this issue 2026-02-21 18:12:11 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Sep 19, 2024):

The issue you're encountering with the MILVUS_URI setting is due to how Docker handles networking. In Docker, 127.0.0.1 or localhost refers to the container itself, not the host machine or other containers. Therefore, the Milvus service cannot be reached using these addresses.

Instead, you should use the service name defined in the Docker Compose file, which allows Docker's internal DNS to resolve the correct container. For example, if the Milvus service is defined in the Docker Compose file with the name milvus-standalone, you should set MILVUS_URI to http://milvus-standalone:19530.

Here's how you can update your .env file:

MILVUS_URI=http://milvus-standalone:19530

This way, Docker will correctly route the request to the Milvus container.

For more details, you can refer to the Dify documentation and the .env.example file in the repository [1][2][3][4].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Sep 19, 2024): <!-- Answer --> The issue you're encountering with the `MILVUS_URI` setting is due to how Docker handles networking. In Docker, `127.0.0.1` or `localhost` refers to the container itself, not the host machine or other containers. Therefore, the Milvus service cannot be reached using these addresses. Instead, you should use the service name defined in the Docker Compose file, which allows Docker's internal DNS to resolve the correct container. For example, if the Milvus service is defined in the Docker Compose file with the name `milvus-standalone`, you should set `MILVUS_URI` to `http://milvus-standalone:19530`. Here's how you can update your `.env` file: ```shell MILVUS_URI=http://milvus-standalone:19530 ``` This way, Docker will correctly route the request to the Milvus container. For more details, you can refer to the Dify documentation and the `.env.example` file in the repository <sup>[[1]](https://github.com/langgenius/dify/blob/main/docker/docker-compose.yaml)</sup><sup>[[2]](https://github.com/langgenius/dify/blob/main/docker/.env.example)</sup><sup>[[3]](https://github.com/langgenius/dify-docs/blob/main/jp/getting-started/install-self-hosted/environments.md)</sup><sup>[[4]](https://github.com/langgenius/dify-docs/blob/main/en/getting-started/install-self-hosted/install-faq.md)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#5688