# When I run the app locally, it works fine, but after building a Docker image and running it, I’m getting a ConnectionTimeout error.Tried skipping init checks and increasing timeout in the additional configs, but no luck. What should I do?

**URL:** <https://forum.weaviate.io/t/when-i-run-the-app-locally-it-works-fine-but-after-building-a-docker-image-and-running-it-i-m-getting-a-connectiontimeout-error-tried-skipping-init-checks-and-increasing-timeout-in-the-additional-configs-but-no-luck-what-should-i-do/9354>\
**Category:** Support\
**Tags:** integration, developer-experience, wcs, python, technical\
**Created:** [December 20, 2024, 7:27am UTC](https://forum.weaviate.io/t/when-i-run-the-app-locally-it-works-fine-but-after-building-a-docker-image-and-running-it-i-m-getting-a-connectiontimeout-error-tried-skipping-init-checks-and-increasing-timeout-in-the-additional-configs-but-no-luck-what-should-i-do/9354 "2024-12-20T07:27:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aprameyan\_V](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/aprameyan_v/32/3216_2.png) [@Aprameyan\_V](https://forum.weaviate.io/u/Aprameyan_V)\
**Post date:** [December 20, 2024, 7:27am UTC](https://forum.weaviate.io/t/when-i-run-the-app-locally-it-works-fine-but-after-building-a-docker-image-and-running-it-i-m-getting-a-connectiontimeout-error-tried-skipping-init-checks-and-increasing-timeout-in-the-additional-configs-but-no-luck-what-should-i-do/9354/1 "2024-12-20T07:27:42Z")

</div>

my code

```auto
client = weaviate.connect_to_weaviate_cloud(
    cluster_url=URL,
    auth_credentials=Auth.api_key(APIKEY),
    additional_config=AdditionalConfig(timeout=Timeout(init=100, query=60, insert=120)), # Increased timeout
    skip_init_checks=True, # Skip initial connection checks to avoid timeouts
    headers={
        "X-HuggingFace-Api-Key": os.getenv("HUGGING_FACE_API") # Pass custom headers if needed
    }
)

```

The error traceback is as follows

```auto
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/httpx/_transports/default.py", line 101, in map_httpcore_exceptions
    yield
  File "/usr/local/lib/python3.13/site-packages/httpx/_transports/default.py", line 394, in handle_async_request
    resp = await self._pool.handle_async_request(req)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/httpcore/_async/connection_pool.py", line 256, in handle_async_request
    raise exc from None
  File "/usr/local/lib/python3.13/site-packages/httpcore/_async/connection_pool.py", line 236, in handle_async_request
    response = await connection.handle_async_request(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        pool_request.request
        ^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/httpcore/_async/connection.py", line 101, in handle_async_request
    raise exc
  File "/usr/local/lib/python3.13/site-packages/httpcore/_async/connection.py", line 78, in handle_async_request
    stream = await self._connect(request)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/httpcore/_async/connection.py", line 124, in _connect
    stream = await self._network_backend.connect_tcp(**kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/httpcore/_backends/auto.py", line 31, in connect_tcp
    return await self._backend.connect_tcp(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<5 lines>...
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/httpcore/_backends/anyio.py", line 113, in connect_tcp
    with map_exceptions(exc_map):
         ~~~~~~~~~~~~~~ ^^^^^^^^^
  File "/usr/local/lib/python3.13/contextlib.py", line 162, in __exit__
    self.gen.throw(value)
    ~~~~~~~~~~~~~~ ^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
    raise to_exc(exc) from exc
httpcore.ConnectTimeout

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/streamlit/runtime/scriptrunner/exec_code.py", line 88, in exec_func_with_error_handling
    result = func()
  File "/usr/local/lib/python3.13/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 579, in code_to_exec
    exec(code, module. __dict__ )
    ~~~~ ^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/app.py", line 31, in <module>
    client = weaviate.connect_to_weaviate_cloud(
        cluster_url=URL,
    ...<5 lines>...
        }
    )
  File "/usr/local/lib/python3.13/site-packages/weaviate/connect/helpers.py", line 80, in connect_to_weaviate_cloud
    return __connect(
        WeaviateClient(
    ...<8 lines>...
        )
    )
  File "/usr/local/lib/python3.13/site-packages/weaviate/connect/helpers.py", line 411, in __connect
    raise e
  File "/usr/local/lib/python3.13/site-packages/weaviate/connect/helpers.py", line 407, in __connect
    client.connect()
    ~~~~~~~~~~~~~~ ^^
  File "/usr/local/lib/python3.13/site-packages/weaviate/syncify.py", line 23, in sync_method
    return _EventLoopSingleton.get_instance().run_until_complete(
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
        async_func, self, *args, **kwargs
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/weaviate/event_loop.py", line 42, in run_until_complete
    return fut.result()
           ~~~~~~~~~~ ^^
  File "/usr/local/lib/python3.13/concurrent/futures/_base.py", line 456, in result
    return self.__get_result()
           ~~~~~~~~~~~~~~~~~ ^^
  File "/usr/local/lib/python3.13/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/usr/local/lib/python3.13/site-packages/weaviate/client_base.py", line 153, in connect
    await self._connection.connect(self._skip_init_checks)
  File "/usr/local/lib/python3.13/site-packages/weaviate/connect/v4.py", line 158, in connect
    meta = await self.get_meta()
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/weaviate/connect/v4.py", line 609, in get_meta
    response = await self.get(path="/meta")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/weaviate/connect/v4.py", line 568, in get
    return await self.__send(
           ^^^^^^^^^^^^^^^^^^
    ...<5 lines>...
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/weaviate/connect/v4.py", line 489, in __send
    raise e
  File "/usr/local/lib/python3.13/site-packages/weaviate/connect/v4.py", line 476, in __send
    res = await self._client.send(req)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/httpx/_client.py", line 1629, in send
    response = await self._send_handling_auth(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<4 lines>...
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/httpx/_client.py", line 1657, in _send_handling_auth
    response = await self._send_handling_redirects(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<3 lines>...
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/httpx/_client.py", line 1694, in _send_handling_redirects
    response = await self._send_single_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/httpx/_client.py", line 1730, in _send_single_request
    response = await transport.handle_async_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/httpx/_transports/default.py", line 393, in handle_async_request
    with map_httpcore_exceptions():
         ~~~~~~~~~~~~~~~~~~~~~~~ ^^
  File "/usr/local/lib/python3.13/contextlib.py", line 162, in __exit__
    self.gen.throw(value)
    ~~~~~~~~~~~~~~ ^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/httpx/_transports/default.py", line 118, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.ConnectTimeout

```

---

<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:** [December 20, 2024, 1:51pm UTC](https://forum.weaviate.io/t/when-i-run-the-app-locally-it-works-fine-but-after-building-a-docker-image-and-running-it-i-m-getting-a-connectiontimeout-error-tried-skipping-init-checks-and-increasing-timeout-in-the-additional-configs-but-no-luck-what-should-i-do/9354/2 "2024-12-20T13:51:01Z")

</div>

hi @Aprameyan_V !!

Welcome to our community 🤗

`weaviate.connect_to_weaviate_cloud` should only be used with clusters hosted in our cloud.

if running with docker, and exposing the 8080 and 50051 ports as configured in the default docker-compose, you can use `weaviate.connect_to_local`

If you have any differente deployment, you can customize it as stated here:

> **[Custom connections | Weaviate](https://weaviate.io/developers/weaviate/connections/connect-custom)**
>
> The Python Client v4 and the TypeScript Client v3 provide helper methods for common connection types. They also provide custom methods for when you need additional connection configuration.

Let me know if this helps.

Are you by any chance trying to use the `connect_to_weaviate_cloud` to connect to a weaviate running on localhost with docker?
