# Kong gateway (Docker installation) - Connection refused when accessing server

**URL:** <https://discuss.konghq.com/t/kong-gateway-docker-installation-connection-refused-when-accessing-server/11184>\
**Category:** General\
**Tags:** kong-gateway\
**Created:** [February 9, 2023, 10:27am UTC](https://discuss.konghq.com/t/kong-gateway-docker-installation-connection-refused-when-accessing-server/11184 "2023-02-09T10:27:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mehrdad\_Asadi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/mehrdad_asadi/32/3833_2.png) [@Mehrdad\_Asadi](https://discuss.konghq.com/u/Mehrdad_Asadi)\
**Post date:** [February 9, 2023, 10:27am UTC](https://discuss.konghq.com/t/kong-gateway-docker-installation-connection-refused-when-accessing-server/11184/1 "2023-02-09T10:27:26Z")

</div>

I have installed Kong Gateway using docker installation. I have a FastAPI service running on port 8080 of the host (127.0.0.1:8080).  
@app.get(“/test”)  
def read\_root():  
return {“Hello”: “World”)

Here is also how my services on Kong looks like :8001/services - 192.168.42.93 this IP is my host’s IP (because kong is running on the container and as far as I know I should not use loopback ip.  
{  
“data”: [  
{  
“host”: “192.168.42.93”,  
“enabled”: true,  
“retries”: 5,  
“write\_timeout”: 60000,  
“protocol”: “http”,  
“port”: 8080,  
“tls\_verify”: null,  
“client\_certificate”: null,  
“tags”: [  
“OAS3\_import”,  
“OAS3file\_openapi.yaml”  
],  
“tls\_verify\_depth”: null,  
“path”: “/”,  
“id”: “7e501eed-c5ba-4d84-9cf5-a4f5234b379f”,  
“updated\_at”: 1675935518,  
“read\_timeout”: 60000,  
“connect\_timeout”: 60000,  
“created\_at”: 1675935518,  
“name”: “XAI\_Microservices”,  
“ca\_certificates”: null  
}  
],  
“next”: null  
}

I then managed to get the OpenAPI specs and generated the .yaml file for use by deck Sync.  
However, as you can see I cannot access the service by Kong gateway, getting the “Connection refused error”.

kong\_1 | 2023/02/09 10:26:49 [error] 1117#0: \*7418308 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.170.1, server: kong, request: “GET /test HTTP/1.1”, upstream: “[http://192.168.42.93:8080/test](http://192.168.42.93:8080/test)”, host: “127.0.0.1:8000”  
kong\_1 | 192.168.170.1 - - [09/Feb/2023:10:26:49 +0000] “GET /test HTTP/1.1” 502 75 “-” “insomnia/2022.7.5”

any help would be appreciated pls!

---

<div class="post-metadata">

**Author:** ![fomm](https://avatars.discourse-cdn.com/v4/letter/f/ea666f/32.png) [@fomm](https://discuss.konghq.com/u/fomm)\
**Post date:** [February 9, 2023, 11:13am UTC](https://discuss.konghq.com/t/kong-gateway-docker-installation-connection-refused-when-accessing-server/11184/2 "2023-02-09T11:13:54Z")

</div>

If you use macos, try using `host.docker.internal` as the service host.

If you use linux, find your docker network (which kong container is running) gateway ip and use that as service host.
