I just moved the weaviate instance to its own docker but still on the same machine. Now I can’t connect to it. I have tried ‘localhost’, ‘172.29.0.2’, ‘127.0.0.1’, ‘0.0.0.0’, ‘host.docker.internal’, and ‘myserver.com’
What am I missing? Do I need to set up a reverse proxy now in nginx?
If your client is running in the same network where Weaviate is within docker, and the service name is called weaviate, this should be what you have to use.
Otherwise, if your client is running outside of docker, you should use the IP or the hostname where the ports are binded.
You must use network gateway ip from there, @Dan_Gordon
-docker network ls
find your network for that project, then
-docker inspect network (networkaddress)
when the data network shown at the top of u can find network gateway IP
when you use that ip form the weaviatehost its works fine
it seems like that (http://172.12.0.1:8080)
connection_params = weaviate.connect.ConnectionParams(
File "/Users/anand/miniconda3/envs/cerebro/lib/python3.9/site-packages/pydantic/main.py", line 164, in __init__
__pydantic_self__.__pydantic_validator__.validate_python(data, self_instance=__pydantic_self__)
pydantic_core._pydantic_core.ValidationError: 2 validation errors for ConnectionParams
http
Field required [type=missing, input_value={'scheme': 'http', 'host'...', 'grpc_secure': False}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.5/v/missing
grpc
Field required [type=missing, input_value={'scheme': 'http', 'host'...', 'grpc_secure': False}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.5/v/missing
Short answer - YES, the explicit connection worked…
I tried many things to get inter-container Docker networking to function. I had even found the same web page as above, but stopped at v4-client-helper-functions just above the “explicit” connection section you highlighted. The weaviate.connect_to_custom() looks almost identical to the explicit function, but of course it fails…???
Is there an explanation as to why we need to use an explicit connection in the case of Docker? And why connect_to_custom() will not work?
I’m glad it’s working, but this was hard to figure out…at least for me…
This is because it will all depend on how you have deployed Weaviate in docker.
For example, it can be exposed on a different port, or a different hostname. It can be secured or insecured.
So you need to “pair” your connection parameters with how you have deployed Weaviate.
On the case of connecting a client that is running on a container, to Weaviate that is also running on a container, usually setting the host to weaviate (or whatever service name you set in your docker compose), http_port to 8080, grpc_port to 50051, all unsercure (grpc_secure=False, http_secure=False) should work.
Of course, considering that both services are in the same docker compose or at the same network and has connectivity between them.