# Issues Configuring weaviate to work with an ollama Docker Instance (v4 client)

**URL:** <https://forum.weaviate.io/t/issues-configuring-weaviate-to-work-with-an-ollama-docker-instance-v4-client/9690>\
**Category:** Support\
**Tags:** documentation\
**Created:** [January 12, 2025, 6:49pm UTC](https://forum.weaviate.io/t/issues-configuring-weaviate-to-work-with-an-ollama-docker-instance-v4-client/9690 "2025-01-12T18:49:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Supavit](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/supavit/32/3352_2.png) [@Supavit](https://forum.weaviate.io/u/Supavit)\
**Post date:** [January 12, 2025, 6:49pm UTC](https://forum.weaviate.io/t/issues-configuring-weaviate-to-work-with-an-ollama-docker-instance-v4-client/9690/1 "2025-01-12T18:49:57Z")

</div>

Hi everyone, I’m running into some challenges while trying to intergrate Weaviate with an Ollama Docker (with CUDA support) Instance. They are both ran in an docker container on the same server. However, I keep encoutering errors when Weaviate tries to connect to Ollama. I’m using the v4 Python client, and the main issue seems to be related to how Weaviate is trying to communicate with Ollama.  
( SInce im a new user I can only use to links so I will be replacing them as following: [http://192.168.x.x](http://192.168.x.x) with URL)

**Setup Details**  
1.`Weaviate Docker Setup`

- Image: `cr.weaviate.io/semitechnologies/weaviate:1.28.2`
- Environment Variables:  
environment:  
ENABLE\_MODULES: text2vec-ollama,generative-ollama  
OLLAMA\_URL: `URL:11434`  
WEAVIATE\_HOST: 0.0.0.0  
WEAVIATE\_PORT: 8080  
WEAVIATE\_GRPC: 50051
- Ports:  
ports:  
– 8080:8080  
– 50051:50051

1. `Ollama Docker Setup`

- Image: ollama/ollama
- CUDA Support: Configured with nvidia-container-toolkit
- Ports: 11434:11434

1. `Schema Configuration`  
(since Weaviate is running in a docker container, I have tried host.docker.internal:11434 and localhost:11434 which don’t give a other result then with the current setup)  
{  
“class”: “Article”,  
“vectorizer”: “text2vec-ollama”,  
“vectorIndexConfig”: {  
“distance”: “cosine”  
},  
“modelConfig”: {  
“text2vec-ollama”: {  
“apiEndpoint”: “URL:11434”,  
“model”: “nomic-embed-text”  
},  
“generative-ollama”: {  
“apiEndpoint”: “URL:11434”,  
“model”: “llama3.2”  
}  
},  
“properties”: [  
{“name”: “title”, “dataType”: [“text”]},  
{“name”: “content”, “dataType”: [“text”]},  
{“name”: “authors”, “dataType”: [“text”]},  
{“name”: “publicationDate”, “dataType”: [“date”]},  
{“name”: “category”, “dataType”: [“text”]},  
{“name”: “tags”, “dataType”: [“text”]},  
{“name”: “url”, “dataType”: [“text”]},  
{“name”: “scrapeDate”, “dataType”: [“date”]},  
{“name”: “createdDate”, “dataType”: [“date”]},  
{“name”: “articleId”, “dataType”: [“text”], “index”: true, “primaryKey”: true}  
]  
}
2. `Python Client Initialization`  
import weaviate  
import os  
from dotenv import load\_dotenv

load\_dotenv()

client = weaviate.connect\_to\_local(  
host=os.getenv(“WEAVIATE\_HOST”, “127.0.0.1”),  
port=int(os.getenv(“WEAVIATE\_PORT”, 8080)),  
grpc\_port=int(os.getenv(“WEAVIATE\_GRPC”, 50051))  
)

**Issue**  
When running my script to insert data into Weaviate (ran on an other computer then the docker containers), I encouter the following error:  
`weaviate.exceptions.UnexpectedStatusCodeError: Object was not added! Unexpected status code: 500, with response body: {'error': [{'message': 'update vector: send POST request: Post "http://localhost:11434/api/embed": dial tcp [::1]:11434: connect: connection refused'}]}.`

**Questions**

1. Why is Weaviate defaulting to localhost:11434 even thought the schema specifies URL:11434, host.docker.internal:11434 for apiEndpoint?
2. Is there any additional configuration needed to make Weaviate v4 properly use the OLLAMA\_URL?
3. Am I missing any critical step in the setup to make these two services communicate?
4. How does Weaviate internally handle the communication with external modules like Ollama? Is there a way to debug these request in more detail?

**Appreciation**  
Thanks in advance for any help or pointers! I’m happy to provide additional logs or configuration details if needed. Let me know how I can further debug this.

Kind regards!

---

<div class="post-metadata">

**Author:** ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)\
**Post date:** [January 27, 2025, 9:02pm UTC](https://forum.weaviate.io/t/issues-configuring-weaviate-to-work-with-an-ollama-docker-instance-v4-client/9690/2 "2025-01-27T21:02:13Z")

</div>

hi @Supavit !!

Welcome to our community 🤗

How are you creating this collection?

Because both ollama and weaviate are running on the same network, you need to set it up as `http://ollama:11434`

Check out this one forum thread for more:

> [@\[Question\] Getting Weaviate and Ollama working together running locally](https://forum.weaviate.io/t/question-getting-weaviate-and-ollama-working-together-running-locally/9818):
>
> I have been trying to get weaviate and ollama working together on my local machine. I have yet to get weaviate to successfully connect to ollama at all. Does anyone any tips? Here is my docker-compose.yml file: version: "3.7" services: weaviate: image: cr.weaviate.io/semitechnologies/weaviate:1.28.2 ports: - 8080:8080 - 50051:50051 environment: ENABLE\_MODULES: text2vec-ollama OLLAMA\_URL: http://ollama:11434 TEXT2VEC\_OLLAMA\_BASE\_URL: http://ollama:1…
