louislam / uptime-kuma

A fancy self-hosted monitoring tool
https://uptime.kuma.pet
MIT License
57.06k stars 5.14k forks source link

Container name resolution fails for DNS monitor #5153

Open anatolyelberg opened 1 week ago

anatolyelberg commented 1 week ago

πŸ“‘ I have found these related issues/pull requests

Likely related to #4707

πŸ›‘οΈ Security Policy

Description

Uptime Kuma is running as a Docker container (container name is uptimekuma). On the same Docker host there's AdGuard-Home DNS server (container name is adguard). Both are running on the same custom bridge network (not default 'bridge'), and are working fine. I have many TCP, HTTP, and HTTP content monitors, and in all cases both FQDN and container names resolve as expected. The problem appears to be only for DNS monitors. If I hard-code container's IP address in the DNS monitor - it works. But if I specify adguard as a Resolver Server, the DNS monitor fails, and I see this in the container logs: Failing: Invalid IP address: ["adguard"]:53.

IMHO, Resolver Server should be able to be a hostname, because IP addresses do change, especially the dynamic IPs of Docker containers.

πŸ‘Ÿ Reproduction steps

Anytime a DNS monitor is used to monitor a DNS server running in a container on the same Docker host and network as the Uptime Kuma container.

πŸ‘€ Expected behavior

Container name should resolve to an IP address on the Docker network

πŸ˜“ Actual Behavior

Container name resolution fails

🐻 Uptime-Kuma Version

1.23.15

πŸ’» Operating System and Arch

Raspberry Pi OS 12

🌐 Browser

Firefox 130.0.1

πŸ–₯️ Deployment Environment

πŸ“ Relevant log output

Failing: Invalid IP address: ["adguard"]:53
skreza commented 6 days ago

+1 I have the exact same use case running adguard also, this would be amazing if you could have a resolver set to another docker container by container name allowing us to have up/down status of DNS resolution by adguard container.

louislam commented 10 minutes ago

I think it may be due to the default DNS resolver set to 1.1.1.1.