# Can't connect to localhost:8080 from CI

**URL:** <https://discuss.circleci.com/t/cant-connect-to-localhost-8080-from-ci/42476>\
**Category:** Running Tests\
**Tags:** nodejs, docker\
**Created:** [January 5, 2022, 6:35am UTC](https://discuss.circleci.com/t/cant-connect-to-localhost-8080-from-ci/42476 "2022-01-05T06:35:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RoniFinTech](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/ronifintech/32/29068_2.png) [@RoniFinTech](https://discuss.circleci.com/u/RoniFinTech)\
**Post date:** [January 5, 2022, 6:35am UTC](https://discuss.circleci.com/t/cant-connect-to-localhost-8080-from-ci/42476/1 "2022-01-05T06:35:46Z")

</div>

Hi,  
I’m trying to run Jest tests during CI.  
The tests need to access a docker container that I spin up using the docker-compose command.

This is the error I get:

`FetchError: request to http://127.0.0.1:8080/v1/graphql failed, reason: connect ECONNREFUSED 127.0.0.1:8080`

Any idea if I need to use a different IP or set the docker container under this fixed IP?

---

<div class="post-metadata">

**Author:** ![RoniFinTech](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/ronifintech/32/29068_2.png) [@RoniFinTech](https://discuss.circleci.com/u/RoniFinTech)\
**Post date:** [January 9, 2022, 7:11pm UTC](https://discuss.circleci.com/t/cant-connect-to-localhost-8080-from-ci/42476/2 "2022-01-09T19:11:40Z")

</div>

I was able to solve the problem by following these steps:  
build the docker images as part of the circleci config file instead of having them in docker-compose.  
Then, instead of using localhost, I used the docker image name as the address (e.g. `postgres`, `hasura`).

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [January 19, 2022, 7:12pm UTC](https://discuss.circleci.com/t/cant-connect-to-localhost-8080-from-ci/42476/3 "2022-01-19T19:12:11Z")

</div>

Closed on January 19, 2022, 7:12pm UTC

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
