[GH-ISSUE #8881] ollama docker api how to bind 0.0.0.0? #52269

Closed
opened 2026-04-28 22:46:29 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @CoderCore on GitHub (Feb 6, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/8881

i use a ollama docker, api bind localhost:11434 default, how to change it?

Originally created by @CoderCore on GitHub (Feb 6, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/8881 i use a ollama docker, api bind localhost:11434 default, how to change it?
Author
Owner

@rick-github commented on GitHub (Feb 6, 2025):

docker run -p 11434:11434 ollama/ollama

or

services:
  ollama:
    image: ollama/ollama
    ports:
      - 11434:11434
<!-- gh-comment-id:2639480572 --> @rick-github commented on GitHub (Feb 6, 2025): ```console docker run -p 11434:11434 ollama/ollama ``` or ```yaml services: ollama: image: ollama/ollama ports: - 11434:11434 ```
Author
Owner

@CoderCore commented on GitHub (Feb 6, 2025):

docker run -p 11434:11434 ollama/ollama
or

services:
ollama:
image: ollama/ollama
ports:
- 11434:11434

I know, but in ollama docker ,api bind is localhost:11434, not 0.0.0.0:11434.

<!-- gh-comment-id:2639530837 --> @CoderCore commented on GitHub (Feb 6, 2025): > docker run -p 11434:11434 ollama/ollama > or > > services: > ollama: > image: ollama/ollama > ports: > - 11434:11434 I know, but in ollama docker ,api bind is localhost:11434, not 0.0.0.0:11434.
Author
Owner

@rick-github commented on GitHub (Feb 6, 2025):

ollama binds to localhost:11434 inside the container. -p 11434:114341 or ports: - 11434:11434 routes that to the external interface on the host.

<!-- gh-comment-id:2639557531 --> @rick-github commented on GitHub (Feb 6, 2025): ollama binds to localhost:11434 inside the container. `-p 11434:114341` or `ports: - 11434:11434` routes that to the external interface on the host.
Author
Owner

@CoderCore commented on GitHub (Feb 6, 2025):

ollama binds to localhost:11434 inside the container. -p 11434:114341 or ports: - 11434:11434 routes that to the external interface on the host.

The key is ollama api bind ip.
-e OLLAMA_HOST="0.0.0.0"

i use this command, it works.
docker run -d -p 3000:8080 -p 11434:11434 -e OLLAMA_HOST="0.0.0.0" --gpus=all --add-host=api.openai.com:127.0.0.1 -v /root/.ollama:/root/.ollama -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:ollama

<!-- gh-comment-id:2639565544 --> @CoderCore commented on GitHub (Feb 6, 2025): > ollama binds to localhost:11434 inside the container. `-p 11434:114341` or `ports: - 11434:11434` routes that to the external interface on the host. The key is ollama api bind ip. `-e OLLAMA_HOST="0.0.0.0" ` i use this command, it works. `docker run -d -p 3000:8080 -p 11434:11434 -e OLLAMA_HOST="0.0.0.0" --gpus=all --add-host=api.openai.com:127.0.0.1 -v /root/.ollama:/root/.ollama -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:ollama`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#52269