[GH-ISSUE #7230] Connectivyt issue #4590

Closed
opened 2026-04-12 15:31:01 -05:00 by GiteaMirror · 10 comments
Owner

Originally created by @rootrobot10 on GitHub (Oct 16, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/7230

What is the issue?

I have run gify in docker and ollama as direct service in the server.

root@ollama:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f9382054cfa1 nginx:latest "/docker-entrypoint.…" 27 minutes ago Up 27 minutes 0.0.0.0:80->80/tcp, :::80->80/tcp docker-legacy_nginx_1
82affd92a4d5 langgenius/dify-api:0.9.2 "/bin/bash /entrypoi…" 27 minutes ago Up 27 minutes 5001/tcp docker-legacy_api_1
8d70ef1a96fd langgenius/dify-api:0.9.2 "/bin/bash /entrypoi…" 27 minutes ago Up 27 minutes 5001/tcp docker-legacy_worker_1
079ff127c14d postgres:15-alpine "docker-entrypoint.s…" 27 minutes ago Up 27 minutes (healthy) 5432/tcp docker-legacy_db_1
5d5ef080c04d semitechnologies/weaviate:1.19.0 "/bin/weaviate --hos…" 27 minutes ago Up 27 minutes docker-legacy_weaviate_1
fe60c43cafb1 langgenius/dify-web:0.9.2 "/bin/sh ./entrypoin…" 27 minutes ago Up 27 minutes 3000/tcp docker-legacy_web_1
c91af8db18f3 langgenius/dify-sandbox:0.2.1 "/main" 27 minutes ago Up 27 minutes docker-legacy_sandbox_1
247acb28c41c redis:6-alpine "docker-entrypoint.s…" 27 minutes ago Up 27 minutes (healthy) 6379/tcp docker-legacy_redis_1
1df0e293e1cd ubuntu/squid:latest "entrypoint.sh -f /e…" 27 minutes ago Up 27 minutes 3128/tcp docker-legacy_ssrf_proxy_1

root@ollma:~# netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:11434 0.0.0.0:* LISTEN 978916/ollama
tcp 0 0 0.0.0.0:222 0.0.0.0:* LISTEN 1351/sshd: /usr/sbi
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 438200/docker-proxy
tcp 0 0 127.0.0.1:46765 0.0.0.0:* LISTEN 97650/containerd

However connecting from gify dashboard to ollama provider. I got connectivity issue. To resolve i have tried change ollam host to 0.0.0.0 instead of 127.0.0.0.1 and conenct on server ip.

changed it here. /etc/systemd/system/ollama.service

[Unit]
Description=Ollama Service
After=network-online.target

[Service]
ExecStart=/usr/local/bin/ollama serve --host 0.0.0.0
User=ollama
Group=ollama
Restart=always
RestartSec=3
Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"
Environment="OLLAMA_HOST=0.0.0.0"
[Install]
WantedBy=default.target

then did service restart

systemctl daemon-reload
systemctl restart ollama

Still it is not listeint on 0.0.0.0 and not able to connect from dify frontend.

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:11434 0.0.0.0:* LISTEN 978916/ollama
tcp 0 0 0.0.0.0:222 0.0.0.0:* LISTEN 1351/sshd: /usr/sbi
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 438200/docker-proxy
tcp 0 0 127.0.0.1:46765 0.0.0.0:* LISTEN 97650/containerd
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 1176/systemd-resolv
tcp6 0 0 :::222 :::* LISTEN 1351/sshd: /usr/sbi
tcp6 0 0 :::80 :::* LISTEN 438208/docker-proxy

How can i fix it?

OS

No response

GPU

No response

CPU

No response

Ollama version

No response

Originally created by @rootrobot10 on GitHub (Oct 16, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/7230 ### What is the issue? I have run gify in docker and ollama as direct service in the server. root@ollama:~# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES f9382054cfa1 nginx:latest "/docker-entrypoint.…" 27 minutes ago Up 27 minutes 0.0.0.0:80->80/tcp, :::80->80/tcp docker-legacy_nginx_1 82affd92a4d5 langgenius/dify-api:0.9.2 "/bin/bash /entrypoi…" 27 minutes ago Up 27 minutes 5001/tcp docker-legacy_api_1 8d70ef1a96fd langgenius/dify-api:0.9.2 "/bin/bash /entrypoi…" 27 minutes ago Up 27 minutes 5001/tcp docker-legacy_worker_1 079ff127c14d postgres:15-alpine "docker-entrypoint.s…" 27 minutes ago Up 27 minutes (healthy) 5432/tcp docker-legacy_db_1 5d5ef080c04d semitechnologies/weaviate:1.19.0 "/bin/weaviate --hos…" 27 minutes ago Up 27 minutes docker-legacy_weaviate_1 fe60c43cafb1 langgenius/dify-web:0.9.2 "/bin/sh ./entrypoin…" 27 minutes ago Up 27 minutes 3000/tcp docker-legacy_web_1 c91af8db18f3 langgenius/dify-sandbox:0.2.1 "/main" 27 minutes ago Up 27 minutes docker-legacy_sandbox_1 247acb28c41c redis:6-alpine "docker-entrypoint.s…" 27 minutes ago Up 27 minutes (healthy) 6379/tcp docker-legacy_redis_1 1df0e293e1cd ubuntu/squid:latest "entrypoint.sh -f /e…" 27 minutes ago Up 27 minutes 3128/tcp docker-legacy_ssrf_proxy_1 root@ollma:~# netstat -ntlp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1:11434 0.0.0.0:* LISTEN 978916/ollama tcp 0 0 0.0.0.0:222 0.0.0.0:* LISTEN 1351/sshd: /usr/sbi tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 438200/docker-proxy tcp 0 0 127.0.0.1:46765 0.0.0.0:* LISTEN 97650/containerd However connecting from gify dashboard to ollama provider. I got connectivity issue. To resolve i have tried change ollam host to 0.0.0.0 instead of 127.0.0.0.1 and conenct on server ip. changed it here. /etc/systemd/system/ollama.service [Unit] Description=Ollama Service After=network-online.target [Service] ExecStart=/usr/local/bin/ollama serve --host 0.0.0.0 User=ollama Group=ollama Restart=always RestartSec=3 Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin" Environment="OLLAMA_HOST=0.0.0.0" [Install] WantedBy=default.target then did service restart systemctl daemon-reload systemctl restart ollama Still it is not listeint on 0.0.0.0 and not able to connect from dify frontend. Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1:11434 0.0.0.0:* LISTEN 978916/ollama tcp 0 0 0.0.0.0:222 0.0.0.0:* LISTEN 1351/sshd: /usr/sbi tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 438200/docker-proxy tcp 0 0 127.0.0.1:46765 0.0.0.0:* LISTEN 97650/containerd tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 1176/systemd-resolv tcp6 0 0 :::222 :::* LISTEN 1351/sshd: /usr/sbi tcp6 0 0 :::80 :::* LISTEN 438208/docker-proxy How can i fix it? ### OS _No response_ ### GPU _No response_ ### CPU _No response_ ### Ollama version _No response_
GiteaMirror added the bug label 2026-04-12 15:31:01 -05:00
Author
Owner

@rick-github commented on GitHub (Oct 16, 2024):

You don't provide the dify configuration, so I'm guessing you are telling dify to connect to http://127.0.0.1:11434. You can't connect to a localhost address from inside a docker container. You need to configure dify to connect to the real IP address of your machine. Alternatively, run ollama in a container and configure dify to connect to http://ollama:11434.

Also note that --host 0.0.0.0 is not a valid flag for ollama.

<!-- gh-comment-id:2417891346 --> @rick-github commented on GitHub (Oct 16, 2024): You don't provide the dify configuration, so I'm guessing you are telling dify to connect to http://127.0.0.1:11434. You can't connect to a localhost address from inside a docker container. You need to configure dify to connect to the real IP address of your machine. Alternatively, run ollama in a container and configure dify to connect to http://ollama:11434. Also note that `--host 0.0.0.0` is not a valid flag for ollama.
Author
Owner

@rootrobot10 commented on GitHub (Oct 17, 2024):

Yes, like you said I'm trying to make connection from dify to ollma.
How can I configure it? I used dify docker composer. I would like to know the steps. so that from dify it needs to connect to ollama. .

I changed ollam to run in 0.0.0.0 on the server but it is not avialable on server ip:11434 yet.

How to fix it? Basically need to connect dify to ollama. .please help.

<!-- gh-comment-id:2418450459 --> @rootrobot10 commented on GitHub (Oct 17, 2024): Yes, like you said I'm trying to make connection from dify to ollma. How can I configure it? I used dify docker composer. I would like to know the steps. so that from dify it needs to connect to ollama. . I changed ollam to run in 0.0.0.0 on the server but it is not avialable on server ip:11434 yet. How to fix it? Basically need to connect dify to ollama. .please help.
Author
Owner

@rootrobot10 commented on GitHub (Oct 17, 2024):

Right now. .

root@futurelab:~# cat /etc/systemd/system/ollama.service
[Unit]
Description=Ollama Service
After=network-online.target

[Service]
ExecStart=/usr/local/bin/ollama serve
User=ollama
Group=ollama
Restart=always
RestartSec=3
Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"
[Install]
WantedBy=default.target
root@futurelab:#
root@futurelab:
#
root@futurelab:~# netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:11434 0.0.0.0:* LISTEN 1002815/ollama

I want to configure gify runing on conatiner to connect to ollama running directly on the server. How to configure it? where is the doc? Please help

<!-- gh-comment-id:2418455700 --> @rootrobot10 commented on GitHub (Oct 17, 2024): Right now. . root@futurelab:~# cat /etc/systemd/system/ollama.service [Unit] Description=Ollama Service After=network-online.target [Service] ExecStart=/usr/local/bin/ollama serve User=ollama Group=ollama Restart=always RestartSec=3 Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin" [Install] WantedBy=default.target root@futurelab:~# root@futurelab:~# root@futurelab:~# netstat -ntlp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1:11434 0.0.0.0:* LISTEN 1002815/ollama I want to configure gify runing on conatiner to connect to ollama running directly on the server. How to configure it? where is the doc? Please help
Author
Owner

@rick-github commented on GitHub (Oct 17, 2024):

  1. Add Environment="OLLAMA_HOST=0.0.0.0:11434" to the ollama service file.
  2. Restart ollama.
  3. Find the IP address of your machine.
  4. Configure dify to connect to http://<IP address of your machine>:11434
<!-- gh-comment-id:2418747208 --> @rick-github commented on GitHub (Oct 17, 2024): 1. Add `Environment="OLLAMA_HOST=0.0.0.0:11434"` to the ollama service file. 2. Restart ollama. 3. Find the IP address of your machine. 4. Configure dify to connect to http://\<IP address of your machine\>:11434
Author
Owner

@rootrobot10 commented on GitHub (Oct 17, 2024):

4th step, how can I do it?

<!-- gh-comment-id:2418764507 --> @rootrobot10 commented on GitHub (Oct 17, 2024): 4th step, how can I do it?
Author
Owner

@rick-github commented on GitHub (Oct 17, 2024):

https://docs.dify.ai/development/models-integration/ollama

<!-- gh-comment-id:2418789539 --> @rick-github commented on GitHub (Oct 17, 2024): https://docs.dify.ai/development/models-integration/ollama
Author
Owner

@rootrobot10 commented on GitHub (Oct 17, 2024):

That's where I'm getting error. .

I chagned ollama to listen external.

root@futurelab:~# netstat -ntlp | grep 11434
tcp6 0 0 :::11434 :::* LISTEN 1490886/ollama

When integrate gify to ollama. I get errro. That's what im asking for.

image

What can be the issue?

<!-- gh-comment-id:2419424341 --> @rootrobot10 commented on GitHub (Oct 17, 2024): That's where I'm getting error. . I chagned ollama to listen external. root@futurelab:~# netstat -ntlp | grep 11434 tcp6 0 0 :::11434 :::* LISTEN 1490886/ollama When integrate gify to ollama. I get errro. That's what im asking for. ![image](https://github.com/user-attachments/assets/4ada694b-3efc-4687-9b8a-21a80cc18936) What can be the issue?
Author
Owner

@rick-github commented on GitHub (Oct 17, 2024):

Based on the error (Connection to 111.235.68.172 timed out), you might have a firewall that is dropping SYN packets. You can either reconfigure your firewall, or just run ollama in a container.

<!-- gh-comment-id:2419463045 --> @rick-github commented on GitHub (Oct 17, 2024): Based on the error (`Connection to 111.235.68.172 timed out`), you might have a firewall that is dropping SYN packets. You can either reconfigure your firewall, or just run ollama in a container.
Author
Owner

@rootrobot10 commented on GitHub (Oct 17, 2024):

Makes sense. we'll see. thank you

<!-- gh-comment-id:2419572315 --> @rootrobot10 commented on GitHub (Oct 17, 2024): Makes sense. we'll see. thank you
Author
Owner

@rick-github commented on GitHub (Nov 6, 2024):

Closing as appears answered. Please re-open if you still have problems.

<!-- gh-comment-id:2459476398 --> @rick-github commented on GitHub (Nov 6, 2024): Closing as appears answered. Please re-open if you still have problems.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#4590