# Host.docker.internal seems doesnt work with CI/CD Github Action LINUX

**URL:** <https://forums.docker.com/t/host-docker-internal-seems-doesnt-work-with-ci-cd-github-action-linux/119558>\
**Category:** Docker Hub\
**Tags:** ci\_cd\
**Created:** [January 6, 2022, 7:24pm UTC](https://forums.docker.com/t/host-docker-internal-seems-doesnt-work-with-ci-cd-github-action-linux/119558 "2022-01-06T19:24:08Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![nanez](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/nanez/32/56330_2.png) [@nanez](https://forums.docker.com/u/nanez)\
**Post date:** [January 6, 2022, 7:24pm UTC](https://forums.docker.com/t/host-docker-internal-seems-doesnt-work-with-ci-cd-github-action-linux/119558/1 "2022-01-06T19:24:08Z")

</div>

Hello everyone, im new here and using docker. We are developing an app and we need to use a subgraph, so the community that mantain TheSubgraph shared us a repo to run local node and test our subgraph. This work locally as we want, but we need test this with GitHub actions. Im using WSL2 with Ubunto 20.04LTS and this work nicely, but when we execute the GitHub action seems like a node is not connecting correctly. I did a lot of research, and i really think that `host.docker.internal` is not resolving the IP in the GH Action. My PC do that because im using WSL and Docker for Windows and automatically know how resolve it (not sure if this is the real issue but im just thinking about it).

I know is something about this connection because the error is` "WARN Trying again after net_version RPC call failed (attempt #10) with result Err(Transport error: Error(Connect, Os { code: 111, kind: ConnectionRefused, message: "Connection refused" }))"`, which appear when i change the `host.docker.internal` or i added a extra\_host inside the docker-compose. Im not really sure about why this not run inside GitHub action and tbh i read a lot this days trying but wihtout success. So i decide to ask in the forum. This is no my area, but i need to run the test with this node and the tool is perfect to test.

I’ll share the docker-compose.yml file and the repo that the community shared us and we are using:  
This is the [repo](https://github.com/withtally/Generic-Subgraph-Testing), and this is the [docker folder](https://github.com/withtally/Generic-Subgraph-Testing/tree/main/docker)

```auto
version: '3'

services:

  graph-node:

    image: graphprotocol/graph-node:v0.22.0

    ports:

      - '8000:8000'

      - '8001:8001'

      - '8020:8020'

      - '8030:8030'

      - '8040:8040'

    depends_on:

      - ipfs

      - postgres

    environment:

      postgres_host: postgres

      postgres_user: graph-node

      postgres_pass: let-me-in

      postgres_db: graph-node

      ipfs: 'ipfs:5001'

      ethereum: 'localhost:http://host.docker.internal:8545'

      GRAPH_LOG: info

  ipfs:

    image: ipfs/go-ipfs:v0.4.23

    ports:

      - '5001:5001'

    volumes:

      - ./data/ipfs:/data/ipfs

  postgres:

    image: postgres

    ports:

      - '5432:5432'

    command: ["postgres", "-cshared_preload_libraries=pg_stat_statements"]

    environment:

      POSTGRES_USER: graph-node

      POSTGRES_PASSWORD: let-me-in

      POSTGRES_DB: graph-node

    volumes:

      - ./data/postgres:/var/lib/postgresql/data

```

I hope that im asking in the right place and get some help. I tried to run this with CI/CD in Github since like a week. Let me know if is necessary more info or something, i really thanks for any help 🙂

---

<div class="post-metadata">

**Author:** ![rimelek](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/rimelek/32/41602_2.png) [@rimelek](https://forums.docker.com/u/rimelek)\
**Post date:** [January 8, 2022, 2:23am UTC](https://forums.docker.com/t/host-docker-internal-seems-doesnt-work-with-ci-cd-github-action-linux/119558/2 "2022-01-08T02:23:26Z")

</div>

> **[Explore networking features on Docker Desktop](https://docs.docker.com/desktop/networking/)**
>
> Understand how networking works on Docker Desktop and see the known limitations

> `host.docker.internal` which resolves to the internal IP address used by the host. **This is for development purpose and will not work in a production environment outside of Docker Desktop for Windows**.

You could use something like host-gateway: [How to reach localhost on host from docker container? - #5 by meyay](https://forums.docker.com/t/how-to-reach-localhost-on-host-from-docker-container/113321/5)

- or run everything in containers, connect to the same docker network and use the service names.
- Or use the host network in the containers.
- or use static IP address if you know the host IP.

There are multiple potential solutions. It depends on the actual usecase

---

<div class="post-metadata">

**Author:** ![nanez](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/nanez/32/56330_2.png) [@nanez](https://forums.docker.com/u/nanez)\
**Post date:** [January 8, 2022, 4:45am UTC](https://forums.docker.com/t/host-docker-internal-seems-doesnt-work-with-ci-cd-github-action-linux/119558/3 "2022-01-08T04:45:21Z")

</div>

Hello rimelek, thanks for the info. Im very new in Docker. It is my first contact with this, i really appreciate the help. I tried using the extra\_host ( `"host.docker.internal:172.17.0.1"`), but doesnt work even locally. Should be that i using a wrong ip.

- “run everything in containers, connect to the same docker network and use the service names.” - I do not know how make this, but i’ll search it and see.

- “There are multiple potential solutions. It depends on the actual usecase” - Well, we need run the services locally because we are writing the tests, and make sure that is running in GH actions.

Actually, i’ll search everything because i’m not 100% sure what or how do it. I’ll ask again surely, thanks:),

---

<div class="post-metadata">

**Author:** ![rimelek](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/rimelek/32/41602_2.png) [@rimelek](https://forums.docker.com/u/rimelek)\
**Post date:** [January 8, 2022, 10:56am UTC](https://forums.docker.com/t/host-docker-internal-seems-doesnt-work-with-ci-cd-github-action-linux/119558/4 "2022-01-08T10:56:37Z")

</div>

> [@nanez](#):
>
> Should be that i using a wrong ip.

You don’t need IP address. Use “host-gateway” instead. It will be replaced with the proper IP address dynamically.

---

<div class="post-metadata">

**Author:** ![avmagnaye](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/avmagnaye/32/36028_2.png) [@avmagnaye](https://forums.docker.com/u/avmagnaye)\
**Post date:** [August 23, 2022, 11:02pm UTC](https://forums.docker.com/t/host-docker-internal-seems-doesnt-work-with-ci-cd-github-action-linux/119558/5 "2022-08-23T23:02:02Z")

</div>

Hello, im having the same error with my setup. Even though I already set the extra hosts correctly.  
Although this setup is working locally.  
BTW im using docker-compose

```auto
extra_hosts:
      - "host.docker.internal:host-gateway"

```

The environment files connecting to my app are still using host.docker.internal though, is that how it should be?

```auto
db_host=host.docker.internal
db_port=5432

```

this is the docker-compose build error i’m getting on the runner

 ![image](https://global.discourse-cdn.com/docker/original/3X/7/4/74bbc10a7ff40c60e557a0bede5b423f1f54df8f.png)

---

<div class="post-metadata">

**Author:** ![rimelek](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/rimelek/32/41602_2.png) [@rimelek](https://forums.docker.com/u/rimelek)\
**Post date:** [September 1, 2022, 10:51pm UTC](https://forums.docker.com/t/host-docker-internal-seems-doesnt-work-with-ci-cd-github-action-linux/119558/6 "2022-09-01T22:51:18Z")

</div>

If you still have this problem after 9 days: It should work, however I don’t know if Django uses the hosts file or not. If it tries to use a DNS server, it won’t work, because extra hosts are inserted into the hosts file. Bash commands like curl and wget would probably work, but if you try nslookup, that would not recognize the domain either. It could be the same with django.
