[PR #497] [MERGED] Prevent external service localhost question #3373

Closed
opened 2026-02-22 18:33:39 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Mintplex-Labs/anything-llm/pull/497
Author: @timothycarambat
Created: 12/28/2023
Status: Merged
Merged: 12/28/2023
Merged by: @timothycarambat

Base: masterHead: docker-patch


📝 Commits (3)

  • 929a00d Prevent external service localhost question
  • 7e5b75d add 0.0.0.0 to docker-invalid URL
  • 342a720 clarify hint

📊 Changes

3 files changed (+20 additions, -7 deletions)

View changed files

📝 .vscode/settings.json (+1 -0)
📝 docker/Dockerfile (+1 -0)
📝 server/utils/helpers/updateENV.js (+18 -7)

📄 Description

Every time a potential user of AnythingLLM uses AnythingLLM in a dockerized context there is confusion on why some external service running on localhost/loopback [LocalAi, LMStudio, Ollama, Chroma, etc] cannot connect, resulting in failed messages or other problems during use.

This is because localhost or loopback IPs resolve within the AnythingLLM container while the service they wish to connect to uses the host machine network. The full fix is to simply replace localhost or 127.0.0.1 with host.docker.internal and the container can then reach the host machine network.

This is already outlined in the Docker README as an important tag, but considering some may be pulling from remote and never consulting the README this detail gets missed nearly all the time.

This PR blocks localhost or 127.0.0.1 from being used for external services while running inside of Docker.

Hopefully, we never have to answer this question again 😵

AnythingLLM runs multiple services inside the container to support various functions so to prevent port conflicts we use a network bridge and not the host network.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Mintplex-Labs/anything-llm/pull/497 **Author:** [@timothycarambat](https://github.com/timothycarambat) **Created:** 12/28/2023 **Status:** ✅ Merged **Merged:** 12/28/2023 **Merged by:** [@timothycarambat](https://github.com/timothycarambat) **Base:** `master` ← **Head:** `docker-patch` --- ### 📝 Commits (3) - [`929a00d`](https://github.com/Mintplex-Labs/anything-llm/commit/929a00de94d11b58ee61e476cabce0c1bef90204) Prevent external service localhost question - [`7e5b75d`](https://github.com/Mintplex-Labs/anything-llm/commit/7e5b75d7f08352a26ebe699e6ef429e312a68679) add 0.0.0.0 to docker-invalid URL - [`342a720`](https://github.com/Mintplex-Labs/anything-llm/commit/342a720576e90151325e0cc1394b38989ee867ab) clarify hint ### 📊 Changes **3 files changed** (+20 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `.vscode/settings.json` (+1 -0) 📝 `docker/Dockerfile` (+1 -0) 📝 `server/utils/helpers/updateENV.js` (+18 -7) </details> ### 📄 Description Every time a potential user of AnythingLLM uses AnythingLLM in a dockerized context there is confusion on why some external service running on localhost/loopback [LocalAi, LMStudio, Ollama, Chroma, etc] cannot connect, resulting in failed messages or other problems during use. This is because localhost or loopback IPs resolve within the AnythingLLM container while the service they wish to connect to uses the host machine network. The full fix is to simply replace `localhost` or `127.0.0.1` with `host.docker.internal` and the container can then reach the host machine network. This is already outlined in the [Docker README](https://github.com/Mintplex-Labs/anything-llm/blob/master/docker/HOW_TO_USE_DOCKER.md#recommend-way-to-run-dockerized-anythingllm) as an important tag, but considering some may be pulling from remote and never consulting the README this detail gets missed nearly all the time. This PR blocks localhost or 127.0.0.1 from being used for external services while running inside of Docker. Hopefully, we never have to answer this question again 😵 > AnythingLLM runs multiple services inside the container to support various functions so to prevent port conflicts we use a network bridge and not the host network. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-22 18:33:39 -05:00
yindo closed this issue 2026-02-22 18:33:39 -05:00
yindo changed title from [PR #497] Prevent external service localhost question to [PR #497] [MERGED] Prevent external service localhost question 2026-06-05 15:13:05 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#3373