P3TERX / Aria2-Pro-Docker

Aria2 Pro | A perfect Aria2 Docker image | 更好用的 Aria2 Docker 容器镜像
https://hub.docker.com/r/p3terx/aria2-pro
MIT License
3.31k stars 387 forks source link

curl: (28) Resolving timed out after 3000 milliseconds #49

Open yyysuo opened 3 years ago

yyysuo commented 3 years ago

系统:linux x86_64 Openwrt Koolshare Router V2.37 内核:5.4.108 Version 20.10.6 (API: 1.41)

网络hosts模式下,报如下错误,拉取镜像创建容器都没问题,网络应该是通的,但是配置文件下载不下来。

[INFO] Downloading 'aria2.conf' ...

curl: (28) Resolving timed out after 3000 milliseconds

curl: (28) Resolving timed out after 3000 milliseconds

curl: (28) Resolving timed out after 3000 milliseconds

[ERROR] 'aria2.conf' download error, retry ...

[INFO] Downloading 'aria2.conf' ...

hronro commented 3 years ago

Same issue here.

After some further investigation, I found the DNS is not working properly inside the docker container. Normally in Alpine Linux, editing /etc/resolv.conf would be enough for changing DNS, however it did not work in p3terx/s6-alpine.

Could you share the Dockerfile of p3terx/s6-alpine, so I can see what else I can help.

flatline-studios commented 3 years ago

Same issue here... As this is nearly 3 months old, it doesn't look good. :/

UPDATE: It looks like this was a problem with my configuration.

Running:

docker container exec -it aria2-pro cat /etc/resolv.conf

Showed that it was pointing to the host network's private IP address, basically, the private IP address for the host machine... As there's no DNS server running on my host machine (although there once was), then it couldn't resolve any DNS requests.

Having added the correct UID and GUID to the compose file, as well as removing network_type: bridge, and hooking it up to the network I'm using in my docker-compose file:

networks:
  - standard_network

(Where standard_network is the name of my custom docker network)

In this case, it can then resolve the DNS queries properly.

My quick and dirty fix, if you really can't get it working, is to run something like:

docker container exec -it aria2-pro echo nameserver 8.8.8.8 >> /etc/resolv.conf

Which will add Google's DNS server to the containers DNS resolver, which should allow it to work at least... But this does speak of a larger problem in your Docker setup's DNS configuration.

It should also be noted, that at some point this change might be removed. I'm not 100% sure on how/when a containers /etc/resolv.conf file is regenerated, but there is a warning at the top of the file, noting that it is indeed autogenerated, and that changes to the file will likely be lost at a future date.

Hope that helps!

gnattu commented 2 years ago

Although this is an old issue, I want to point out that the reason behind this is that alpine, or the musl based distros have been toxic when IPv6 is not available. The DNS resolver of alpine will treat DNS does not respond with AAAA queries as "timeout" and doesn't even try to fallback to IPv4. IPv4-only DNS is still very common because the ISPs are too lazy to support dual-stack, and some users intentionally filters out AAAA queries because a lot of CDN servers are IPv4 only.

Rebuild this docker image using a glibc based distro like debian could solve the problem at the cost of much larger (about 10 times larger)image size.