New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting ETIMEDOUT while running Telegraf bot in docker container with network mode host #1961
Comments
I get the same problem when I run it on a physical machine.
|
It's likely your network itself that's blocking the request. Try over a VPN? |
As I mentioned on the issue, the problem is not related with network/firewall because I can able to send a GET request inside the docker machine, only telegraf bot getting this error when it's try to access to same URL |
I have no idea why this would affect it. Someone more experienced with Docker should try to help. I'd start by investigating whether it works outside the container, and does it consistently work without However @neko0xff's issue is very likely network blocking requests to Telegram domains. |
docker without host network is working without any problem, also same code works on host machine without docker but when I put it in a docker container with configures as host network then it takes that error |
I recently discovered that Node.js choosing IPv6 by default could be the root of this problem. If you still suffer from this issue, consider testing the following fix: import { setDefaultResultOrder } from "node:dns";
setDefaultResultOrder("ipv4first"); Or if you use legacy require: const { setDefaultResultOrder } = require("node:dns");
setDefaultResultOrder("ipv4first"); This has to be done before calling |
I will try this, thanl you so much |
Did that solve this issue? |
I had a similar issue and fixed it by downgrading the node version to hopefully it will help you too. |
this work on me, but I don't use docker. I use native NodeJS on machine. I got error on |
Downgrading to node 18 (in docker) also fix this issue for me. Compared to node 16, using node 18 is better because it still has security support |
Minimal Example Code Reproducing the Issue
If I run docker container with network mode on host, with this command:
I'm getting this error instantly:
I'm getting 200 response to my request when I logged in to container and make a CURL request to api.telegram.org
If I remove
--network host
from the running command, everything is running smoothlyWhat can be the reason to get this error while running in host mode network?
The text was updated successfully, but these errors were encountered: