stack:Error: connect ETIMEDOUT 172.18.0.2:8080

 why am getting this error, T 172.18.0.2:8080

name:Error

stack:Error: connect ETIMEDOUT 172.18.0.2:8080\n    at Function.AxiosError.from (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/axios@1.12.0/node_modules/axios/lib/core/AxiosError.js:96:14)\n    at RedirectableRequest.handleRequestError (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/axios@1.12.0/node_modules/axios/lib/adapters/http.js:638:25)\n    at RedirectableRequest.emit (node:events:531:35)\n    at ClientRequest.eventHandlers.<computed> (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/follow-redirects@1.15.11/node_modules/follow-redirects/index.js:49:24)\n    at ClientRequest.emit (node:events:519:28)\n    at emitErrorEvent (node:_http_client:105:11)\n    at Socket.socketErrorListener (node:_http_client:518:5)\n    at Socket.emit (node:events:519:28)\n    at emitErrorNT (node:internal/streams/destroy:170:8)\n    at emitErrorCloseNT (node:internal/streams/destroy:129:3)\n    at Axios.request (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/axios@1.12.0/node_modules/axios/lib/core/Axios.js:45:41)\n    at processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at invokeAxios (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@opentelemetry+api@1.9.0_@opentelemetry+sdk-trace-base@1.30_08b575bec2313d5d8a4cc75358971443/node_modules/n8n-core/src/execution-engine/node-execution-context/utils/request-helper-functions.ts:313:10)\n    at proxyRequestToAxios (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@opentelemetry+api@1.9.0_@opentelemetry+sdk-trace-base@1.30_08b575bec2313d5d8a4cc75358971443/node_modules/n8n-core/src/execution-engine/node-execution-context/utils/request-helper-functions.ts:695:20)\n    at Object.request (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@opentelemetry+api@1.9.0_@opentelemetry+sdk-trace-base@1.30_08b575bec2313d5d8a4cc75358971443/node_modules/n8n-core/src/execution-engine/node-execution-context/utils/request-helper-functions.ts:1749:4)

code:ETIMEDOUT



ok so one container is at 172.17.0.2 and another at 172.18.0.2



Your setup has each container (n8n and email crawler) on a  different Docker network —this is why the service name (`email_crawler_service`) cannot be resolved by n8n, resulting in the `getaddrinfo ENOTFOUND` error.


Here’s how to fix this:


 *


 1. Both containers must be on the SAME Docker network 


- Containers with different IP ranges (172.17.x.x vs 172.18.x.x) means they are on different bridges.

- Docker’s internal DNS only works if both are on the same network.


 *


 How to Fix 


 Option A: Using Docker Compose 


1. Create a simple `docker-compose.yml` involving both services:

    ```yaml

    version: '3'

    services:

      n8n:

        image: n8n

        ports:

          - "5688:5678"

        networks:

          - mynetwork

      email_crawler_service:

        image: gurl-main-crawler-app

        ports:

          - "8080:8080"

        networks:

          - mynetwork

    networks:

      mynetwork:

        driver: bridge

    ```

2. Start with:

    ```bash

    docker-compose up -d

    ```

3. Now both will get IPs in the same subnet and  can resolve each other by name .


- In n8n HTTP node, use:

    ```

    http://email_crawler_service:8080/scan?url=...

    ```


 *


 Option B: Manually Connect Both to Same Network 


1. Create a user-defined network (if not using Compose):

    ```bash

    docker network create mynetwork

    ```

2. Connect both containers to this:

    ```bash

    docker network connect mynetwork <n8n-container>

    docker network connect mynetwork <email_crawler_service-container>

    ```

3. Now, test from n8n container:

    ```bash

    docker exec -it <n8n-container> ping email_crawler_service

    ```

- In n8n workflow, use `http://email_crawler_service:8080/scan?...`.


 


 Summary 


-  Different IP ranges = different Docker networks = no DNS resolution 

- Both containers must share a user-defined network for service names to resolve.


 Fix : Connect both to the same network, then your HTTP Request node will work with `http://email_crawler_service:8080`.


Ready to help with Compose file details or manual commands if you want!


[1](http://localhost:5688/workflow/gL5YHg6nJi5rVEvT/0aa466)




PS C:\Users\bum> docker ps



CONTAINER ID   IMAGE                   COMMAND                  CREATED        STATUS       PORTS                                         NAMES

665b6fb607a8   gurl-main-crawler-app   "./crawler"              22 hours ago   Up 8 hours   0.0.0.0:8080->8080/tcp, [::]:8080->8080/tcp   email_crawler_service

8420d112a2c1   redis:7-alpine          "docker-entrypoint.s…"   22 hours ago   Up 8 hours   0.0.0.0:6379->6379/tcp, [::]:6379->6379/tcp   email_crawler_redis

a3e3df5ef8f2   n8nio/n8n:latest        "tini -- /docker-ent…"   2 weeks ago    Up 7 hours   0.0.0.0:5688->5678/tcp, [::]:5688->5678/tcp   hopeful_mendeleev



docker network connect mynetwork hopeful_mendeleev

docker network connect mynetwork email_crawler_service



new IP comes with after restarting docker




172.19.0.2 and 172.19.0.3



Comments

Popular posts from this blog

how to install internet download manger in linux

premium url shortener

convert direct traffic to organic