[GH-ISSUE #759] [FEAT]: Description for configuring Ollama LLM to work out of the box with docker container #439

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

Originally created by @fukuro-kun on GitHub (Feb 19, 2024).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/759

Originally assigned to: @shatfield4 on GitHub.

What would you like to see?

When I set up the Docker container, I already noticed when selecting the LLM under the Ollama item that no LLMs were offered as a selection in the middle after entering the host http://host.docker.internal:11434. When I then opened a workspace and started a conversation, I received the following error:

llama:streaming - could not stream chat. Error: connect ECONNREFUSED 172.17.0.1:11434

although OLLAMA_BASE_PATH='http://host.docker.internal:11434 was set in the .env and --add-host=host.docker.internal:host-gateway to docker run command for this to resolve was added.

System:

  • Ubuntu Mate 23.10
  • current docker image
  • ollama version is 0.1.20

Solution:

  • You should perhaps add somewhere here: HOW_TO_USE_DOCKER.md that ollama itself has a restriction to localhost and 127.0.0.1 by default and what steps need to be taken to make it work.

This means that the IP of the Host inside of the virtual docker network does not bind to port 11434 of the host system by default. It took me several hours to discover and fix this error.

Steps to fix this:

  1. Edit the service file:
    Open /etc/systemd/system/ollama.service and add the following line inside the [Service] section:
    Environment="OLLAMA_HOST=0.0.0.0"
    (the IP can and should of course also be adapted to the respective personal situation, 0.0.0.0 works for all, though.)

  2. Once you’ve made your changes, reload the daemons using the command
    sudo systemctl daemon-reload

  3. and then restart the service with
    sudo systemctl restart ollama

Originally created by @fukuro-kun on GitHub (Feb 19, 2024). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/759 Originally assigned to: @shatfield4 on GitHub. ### What would you like to see? When I set up the Docker container, I already noticed when selecting the LLM under the Ollama item that no LLMs were offered as a selection in the middle after entering the host http://host.docker.internal:11434. When I then opened a workspace and started a conversation, I received the following error: > llama:streaming - could not stream chat. Error: connect ECONNREFUSED 172.17.0.1:11434 although `OLLAMA_BASE_PATH='http://host.docker.internal:11434` was set in the `.env` and `--add-host=host.docker.internal:host-gateway` to docker run command for this to resolve was added. **System:** - Ubuntu Mate 23.10 - current docker image - ollama version is 0.1.20 **Solution**: - [ ] You should perhaps add somewhere here: [HOW_TO_USE_DOCKER.md](https://github.com/Mintplex-Labs/anything-llm/blob/master/docker/HOW_TO_USE_DOCKER.md) that ollama itself has a restriction to localhost and 127.0.0.1 by default and what steps need to be taken to make it work. This means that the IP of the Host inside of the virtual docker network does **not bind to port 11434** of the host system by default. It took me several hours to discover and fix this error. **Steps to fix this:** 1. Edit the service file: Open /etc/systemd/system/ollama.service and add the following line inside the [Service] section: `Environment="OLLAMA_HOST=0.0.0.0"` (the IP can and should of course also be adapted to the respective personal situation, 0.0.0.0 works for all, though.) 2. Once you’ve made your changes, reload the daemons using the command `sudo systemctl daemon-reload` 3. and then restart the service with `sudo systemctl restart ollama`
yindo added the documentation label 2026-02-22 18:19:29 -05:00
yindo closed this issue 2026-02-22 18:19:30 -05:00
yindo changed title from [FEAT]: Description for configuring Ollama LLM to work out of the box with docker container to [GH-ISSUE #759] [FEAT]: Description for configuring Ollama LLM to work out of the box with docker container 2026-06-05 14:35:19 -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#439