Skip to content
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

Checking uptime-kuma itself in a docker container and receiving connect ECONNREFUSED #5603

Open
2 tasks done
instantdreams opened this issue Feb 5, 2025 · 1 comment
Open
2 tasks done
Labels

Comments

@instantdreams
Copy link

⚠️ Please verify that this question has NOT been raised before.

  • I checked and didn't find similar issue

🛡️ Security Policy

📝 Describe your problem

I have two monitors for uptime-kuma:

  1. Direct
    Friendly Name: services.uptime-kuma
    URL: http://192.168.1.93:3001

  2. Reverse Proxy
    Friendly Name: com.example.uptime-kuma
    URL: https://uptime-kuma.example.com

The direct monitor succeeds. The Reverse Proxy monitor fails with error connect ECONNREFUSED 192.168.93.123:443.

For all my servers I create external docker networks and assign each container an ip address within the compose file. I do this for GitOps purposes. For the uptime-kuma container I specifically expose port 3001 on the host ip address of 192.168.1.93. I also define the docker dns settings to my two piholes for the uptime-kuma service.

Here's my compose file configuration:

$ docker compose config
name: uptime-kuma
services:
  uptime-kuma:
    container_name: uptime-kuma
    dns:
      - 192.168.1.91
      - 192.168.1.92
    domainname: example.com
    environment:
      DIRECTORY_APPDATA: /srv/uptime-kuma/data
      PGID: "1000"
      PUID: "1000"
      TZ: America/Edmonton
      UPTIME_KUMA_HIDE_LOG: debug_monitor,info_monitor,debug_cert,info_cert,debug_auth,info_auth,debug_server,info_server,debug_db,info_db,debug_notification,info_notification,debug_socket,info_socket,debug_maintenance,info_maintenance,debug_services,info_services,debug_ratelimit,info_ratelimit
    hostname: uptime-kuma
    image: louislam/uptime-kuma:latest
    networks:
      example-net:
        ipv4_address: 192.168.93.123
    ports:
      - mode: ingress
        host_ip: 192.168.1.93
        target: 3001
        published: "3001"
        protocol: tcp
    restart: unless-stopped
    volumes:
      - type: bind
        source: /srv/uptime-kuma/data
        target: /app/data
        bind:
          create_host_path: true
      - type: bind
        source: /etc/localtime
        target: /etc/localtime
        read_only: true
        bind:
          create_host_path: true
networks:
  example-net:
    name: services
    external: true

How do I configure docker - or the monitor - to use my network DNS rather than the container DNS? I don't think this should require a local proxy.

📝 Error Message(s) or Log

I've reviewed the Troubleshooting guide and searched the issues for any leads.

Here is an example of curl from inside and outside the container:

$ curl https://uptime-kuma.example.com
Found. Redirecting to /dashboard

$ docker exec -it uptime-kuma bash
root@uptime-kuma:/app# curl https://uptime-kuma.example.com --verbose
*   Trying 192.168.93.123...
* TCP_NODELAY set
* connect to 192.168.93.123 port 443 failed: Connection refused
* Failed to connect to uptime-kuma.example.com port 443: Connection refused
* Closing connection 0
curl: (7) Failed to connect to uptime-kuma.example.com port 443: Connection refused

Here's the resolv.conf settings:

$ cat /etc/resolv.conf
nameserver 192.168.1.1

$ docker exec uptime-kuma cat /etc/resolv.conf
# Generated by Docker Engine.
# This file can be edited; Docker Engine will not make further changes once it
# has been modified.

nameserver 127.0.0.11
options ndots:0

# Based on host file: '/etc/resolv.conf' (internal resolver)
# ExtServers: [192.168.1.91 192.168.1.92]
# Overrides: [nameservers]
# Option ndots from: internal

Here's what dig reports:

$ dig

; <<>> DiG 9.18.28-1~deb12u2-Debian <<>>
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 11292
;; flags: qr rd ra; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 1

;; Query time: 20 msec
;; SERVER: 192.168.1.1#53(192.168.1.1) (UDP)
;; WHEN: Wed Feb 05 15:32:11 MST 2025
;; MSG SIZE  rcvd: 239

$ docker exec -it uptime-kuma bash
root@uptime-kuma:/app# apt update && apt --yes install dnsutils
root@uptime-kuma:/app# dig

; <<>> DiG 9.11.5-P4-5.1+deb10u11-Debian <<>>
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 56396
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 1

;; Query time: 28 msec
;; SERVER: 127.0.0.11#53(127.0.0.11)
;; WHEN: Wed Feb 05 15:34:58 MST 2025
;; MSG SIZE  rcvd: 239

Same again but with traceroute:

$ traceroute pihole-1.example.com
traceroute to pihole-1.example.com (192.168.1.91), 30 hops max, 60 byte packets
 1  id-edge1.example.com (192.168.1.91)  0.246 ms  0.320 ms  0.327 ms

$ traceroute uptime-kuma.example.com
traceroute to uptime-kuma.example.com (192.168.1.91), 30 hops max, 60 byte packets
 1  id-edge1.example.com (192.168.1.91)  0.228 ms  0.295 ms  0.282 ms

$ docker exec -it uptime-kuma bash
root@uptime-kuma:/app# apt update && apt --yes install traceroute

root@uptime-kuma:/app# traceroute pihole-1.example.com
traceroute to pihole-1.example.com (192.168.1.91), 30 hops max, 60 byte packets
 1  192.168.93.1 (192.168.93.1)  0.037 ms  0.018 ms  0.016 ms
 2  id-edge1.example.com (192.168.1.91)  0.273 ms  0.298 ms  0.266 ms

root@uptime-kuma:/app# traceroute uptime-kuma.example.com
traceroute to uptime-kuma.example.com (192.168.93.123), 30 hops max, 60 byte packets
 1  uptime-kuma.example.com (192.168.93.123)  0.039 ms  0.018 ms  0.015 ms

🐻 Uptime-Kuma Version

1.23.16

💻 Operating System and Arch

Debian 6.1.112-1 (2024-09-30) x86_64 GNU/Linux

🌐 Browser

Firefox 135.0

🖥️ Deployment Environment

  • Runtime: Docker 27.3.1 Docker Compose 2.29.7
  • Database: sqlite/embedded
  • Filesystem used to store the database on: ext4 SSD
  • number of monitors: 104
@instantdreams
Copy link
Author

instantdreams commented Feb 5, 2025

I just found #2991 which suggests using { "HOST": "pihole-1.example.com" }, I have changed the monitor and will see.

ETA: Nope, that didn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant