[GH-ISSUE #4097] Generation Request Failing When Ollama Server Running Inside a Docker Container #2545

Closed
opened 2026-04-12 12:52:04 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @Deepansharora27 on GitHub (May 2, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/4097

Originally assigned to: @dhiltgen on GitHub.

What is the issue?

Hi,
This is My Dockerfile in Which I am Using the Ollama Base Image

FROM ollama/ollama:0.1.32 AS OllamaServer
WORKDIR /usr/src/app
COPY . . 
EXPOSE 11434
ENV OLLAMA_HOST 0.0.0.0
ENV OLLAMA_ORIGINS=http://0.0.0.0:11434
RUN nohup bash -c "ollama serve &" && sleep 5 && ollama create llama3-custom -f /usr/src/app/model/Modelfile

I am Trying to Deploy this Image as a Container on a Remote VM Instance Deployed on Google Cloud Platform.
Now the Problem is that When I Try to Make a curl request in order to do a generation/chat request from my Local Machine the Operation Times Out . Here I use the Remote VM IP:Port for the Generation Request.
Screenshot 2024-05-02 at 12 50 23 PM

Now the Same Thing If I try to do within the Remote VM via curl localhost:11434, then the Request is Successfull and there is No Operation Time Out.

Can You Advise What Can Be Done On this ? I am Using the Appropriate ENV Variables as Suggested to Bind On all the Network Interfaces

OS

Ubuntu 20.04 LTS

GPU

No response

CPU

Intel, AMD

Ollama version

0.1.32

Originally created by @Deepansharora27 on GitHub (May 2, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/4097 Originally assigned to: @dhiltgen on GitHub. ### What is the issue? Hi, This is My Dockerfile in Which I am Using the Ollama Base Image ``` FROM ollama/ollama:0.1.32 AS OllamaServer WORKDIR /usr/src/app COPY . . EXPOSE 11434 ENV OLLAMA_HOST 0.0.0.0 ENV OLLAMA_ORIGINS=http://0.0.0.0:11434 RUN nohup bash -c "ollama serve &" && sleep 5 && ollama create llama3-custom -f /usr/src/app/model/Modelfile ``` I am Trying to Deploy this Image as a Container on a Remote VM Instance Deployed on Google Cloud Platform. Now the Problem is that When I Try to Make a curl request in order to do a generation/chat request from my Local Machine the Operation Times Out . Here I use the Remote VM IP:Port for the Generation Request. <img width="1447" alt="Screenshot 2024-05-02 at 12 50 23 PM" src="https://github.com/ollama/ollama/assets/43300955/0bf21689-eab1-462e-b7d5-db818c7f3ab4"> Now the Same Thing If I try to do within the Remote VM via curl localhost:11434, then the Request is Successfull and there is No Operation Time Out. Can You Advise What Can Be Done On this ? I am Using the Appropriate ENV Variables as Suggested to Bind On all the Network Interfaces ### OS Ubuntu 20.04 LTS ### GPU _No response_ ### CPU Intel, AMD ### Ollama version 0.1.32
GiteaMirror added the dockerbug labels 2026-04-12 12:52:04 -05:00
Author
Owner

@dhiltgen commented on GitHub (May 2, 2024):

I tried a slight variation of this and was unable to reproduce the failure you described.

% cat Dockerfile
FROM ollama/ollama:0.1.32 AS OllamaServer
WORKDIR /usr/src/app
COPY . .
EXPOSE 11434
ENV OLLAMA_HOST 0.0.0.0
ENV OLLAMA_ORIGINS=http://0.0.0.0:11434
RUN nohup bash -c "ollama serve &" && sleep 5 && ollama pull orca-mini
% docker build -t foo .
...build output...
% docker run --rm -it -p 11434:11434 foo

Then in another terminal

% ollama ls
NAME                    ID              SIZE    MODIFIED
orca-mini:latest        2dbd9f439647    2.0 GB  28 seconds ago
<!-- gh-comment-id:2091156081 --> @dhiltgen commented on GitHub (May 2, 2024): I tried a slight variation of this and was unable to reproduce the failure you described. ``` % cat Dockerfile FROM ollama/ollama:0.1.32 AS OllamaServer WORKDIR /usr/src/app COPY . . EXPOSE 11434 ENV OLLAMA_HOST 0.0.0.0 ENV OLLAMA_ORIGINS=http://0.0.0.0:11434 RUN nohup bash -c "ollama serve &" && sleep 5 && ollama pull orca-mini % docker build -t foo . ...build output... % docker run --rm -it -p 11434:11434 foo ``` Then in another terminal ``` % ollama ls NAME ID SIZE MODIFIED orca-mini:latest 2dbd9f439647 2.0 GB 28 seconds ago ```
Author
Owner

@Deepansharora27 commented on GitHub (May 3, 2024):

@dhiltgen
Thanks for your Prompt Reply Daniel. I am also able to get it working now.
The issue was that the Firewall rule on the VM For Ingress and Egress on Port 11434 was not configured properly and after making the required change, it started to work
Thanks

<!-- gh-comment-id:2092793816 --> @Deepansharora27 commented on GitHub (May 3, 2024): @dhiltgen Thanks for your Prompt Reply Daniel. I am also able to get it working now. The issue was that the Firewall rule on the VM For Ingress and Egress on Port 11434 was not configured properly and after making the required change, it started to work Thanks
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#2545