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

DNS issues with new linuxserver container #1693

Open
shalak opened this issue Sep 4, 2024 · 5 comments
Open

DNS issues with new linuxserver container #1693

shalak opened this issue Sep 4, 2024 · 5 comments
Labels
❓ question Further information is requested

Comments

@shalak
Copy link

shalak commented Sep 4, 2024

Describe the bug

After switching to the new linuxserver-powered container, the influxdb no longer resolves to the docker container of influxdb instance.

Instead, if resolves (via the DHCP-search option), using my LANs DNS server to influxdb.example.org, which points to reverse-proxy instance, thus making the connection to port 8086 impossible.

I noticed that this only affects curl, not ping, and speedtest-tracker uses PHP's curl libs under the hood.

Environment:

  • OS: Ubuntu 22.04.4 LTS
  • Architecture: amd64
  • Browser N/A
  • Version 0.21.2

Additional context

Here's how /etc/resolv.conf looks like:

root@8134903bf950:/# 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
search example.org
options edns0 trust-ad ndots:0

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

The ping resolves DNS properly, via internal Docker DNS service, to 172.20.0.4:

root@8134903bf950:/# ping -c 1 influxdb
PING influxdb (172.20.0.4): 56 data bytes
64 bytes from 172.20.0.4: seq=0 ttl=64 time=0.246 ms
(...)

The curl resolves DNS incorrectly, via my LAN DNS service, I believe because before attempting to resolve influxdb it first applies the DHCP search option and adds .example.org to influxdb, i.e. resolves to my influxdb.example.org address, which is 10.0.0.131 (address of my reverse-proxy, port 8086 is not even open there):

root@8134903bf950:/# curl -v http://influxdb:8086
* Host influxdb:8086 was resolved.
* IPv6: ::ffff:10.0.0.131
* IPv4: 10.0.0.131
*   Trying 10.0.0.131:8086...
* connect to 10.0.0.131 port 8086 from 172.20.0.16 port 37192 failed: Connection refused
*   Trying [::ffff:10.0.0.131]:8086...
* connect to ::ffff:10.0.0.131 port 8086 from ::ffff:172.20.0.16 port 37200 failed: Connection refused
* Failed to connect to influxdb port 8086 after 4 ms: Could not connect to server
* closing connection #0
curl: (7) Failed to connect to influxdb port 8086 after 4 ms: Could not connect to server

As a workaround, I can use influxdb.services_default hostname (services_default is my compose network):

root@8134903bf950:/# curl -v http://influxdb.services_default:8086
* Host influxdb.services_default:8086 was resolved.
* IPv6: (none)
* IPv4: 172.20.0.4
*   Trying 172.20.0.4:8086...
* Connected to influxdb.services_default (172.20.0.4) port 8086
> GET / HTTP/1.1
> Host: influxdb.services_default:8086
> User-Agent: curl/8.9.0
> Accept: */*
>
* Request completely sent off
< HTTP/1.1 200 OK
(...)

I understand that docker image is no longer maintained by the author of this repo, I'll be creating an issue on their side as well, but I decided to create it here for better visibility (people usually tend to visit issues page of the root project first)

@shalak
Copy link
Author

shalak commented Sep 4, 2024

I created an issue at linuxserver.io repo as well.

@alexjustesen
Copy link
Owner

Let's see what they say first, my first guess is this is Docker or networking related and not likely the application core. Keep me posted with their response.

@alexjustesen alexjustesen added the ❓ question Further information is requested label Sep 4, 2024
@svenvg93
Copy link
Contributor

svenvg93 commented Sep 17, 2024

Hi @shalak,

Quickly tested this as well. From the container I can resolve other container names without a problem.

sven@eq12:~$ docker exec -it speedtest-tracker /bin/bash
root@cfd383fb8645:/# curl  influxdb:8086/health
{"name":"influxdb", "message":"ready for queries and writes", "status":"pass", "checks":[], "version": "v2.7.10", "commit": "f302d9730c"}
root@cfd383fb8645:/# curl  influxdb:8086
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="description" content="InfluxDB is a time series platform, purpose-built by InfluxData for storing metrics and events, provides real-time visibility into stacks, sensors, and systems."><title>InfluxDB</title><base href="/"><base href=""><link rel="icon" href="/favicon.ico"></head><body><div id="react-root" data-basepath=""></div><script defer="defer" src="/c9043f38ae.js"></script></body></html>root@cfd383fb8645:/# curl -v  influxdb:8086
* Host influxdb:8086 was resolved.
* IPv6: (none)
* IPv4: 172.22.0.5
*   Trying 172.22.0.5:8086...
* Connected to influxdb (172.22.0.5) port 8086
> GET / HTTP/1.1
> Host: influxdb:8086
> User-Agent: curl/8.9.0
> Accept: */*
> 
* Request completely sent off
< HTTP/1.1 200 OK
< Accept-Ranges: bytes
< Cache-Control: public, max-age=3600
< Content-Length: 534
< Content-Type: text/html; charset=utf-8
< Etag: "5348211558"
< Last-Modified: Thu, 08 Aug 2024 21:15:58 GMT
< X-Influxdb-Build: OSS
< X-Influxdb-Version: v2.7.10
< Date: Tue, 17 Sep 2024 19:05:46 GMT
< 
* Connection #0 to host influxdb left intact
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="description" content="InfluxDB is a time series platform, purpose-built by InfluxData for storing metrics and events, provides real-time visibility into stacks, sensors, and systems."><title>InfluxDB</title><base href="/"><base href=""><link rel="icon" href="/favicon.ico"></head><body><div id="react-root" data-basepath=""></div><script defer="defer" src="/c9043f38ae.js"></script></body></html>roo
root@cfd383fb8645:/# 

I checked your docker compose in the lsio issue and noticed that you are using an external database on dns name. Does that one works or do you have problems with it as well?

@shalak
Copy link
Author

shalak commented Sep 17, 2024

I checked your docker compose in the lsio issue and noticed that you are using an external database on dns name.

I'm not sure what you mean by "external database on dns name". Do you mean the speedtest-db container? It's along the same docker-compose, it's not external. And I do not have a global DNS record for speedtest-db.example.org, thus there's no conflict like with the influxdb container.

@svenvg93
Copy link
Contributor

Yess I meant the speedtest-db container.
I do agree with @alexjustesen that this does not seem to be an Application issue, but more Docker/Networking related.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❓ question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants