Sample Header Ad - 728x90

Why can't "dig" on rockylinux 9 find a container/host named "https" in a docker compose network?

1 vote
1 answer
164 views
Sorry I don't know if this is a docker issue or a dig issue on rockylinux 9. Everything works as expected on rockylinux 8. I have a docker-compose.yml file below with a service named https. That allows the container to be referenced by the hostname https. While ping https works, for some reason dig https (DiG 9.16.23-RH) does not work on rockylinux 9. It does work on rockylinux 8 (DiG 9.11.36-RedHat-9.11.36-16.el8_10.2). If I change the service name to httpsx then dig httpsx works.
services:
  https:
    image: "rockylinux:${RL_VERSION}"
    command: bash -c "yum install -y iputils bind-utils && echo '=====dig version output====' && dig -v && echo '=====ping https output====' && ping -c 3 https && echo '=====dig https output====' && dig +short https"
    environment:
       - RL_VERSION
Working 8:
% RL_VERSION=8 docker-compose up
Attaching to https-1
https-1  | Rocky Linux 8 - AppStream                       5.7 MB/s |  11 MB     00:01    
...
https-1  | Complete!
https-1  | =====dig version output====
https-1  | DiG 9.11.36-RedHat-9.11.36-16.el8_10.2
https-1  | =====ping https output====
https-1  | PING https (172.21.0.2) 56(84) bytes of data.
https-1  | 64 bytes from c3f0c7a6613c (172.21.0.2): icmp_seq=1 ttl=64 time=0.558 ms
https-1  | 64 bytes from c3f0c7a6613c (172.21.0.2): icmp_seq=2 ttl=64 time=0.051 ms
https-1  | 64 bytes from c3f0c7a6613c (172.21.0.2): icmp_seq=3 ttl=64 time=0.040 ms
https-1  | 
https-1  | --- https ping statistics ---
https-1  | 3 packets transmitted, 3 received, 0% packet loss, time 2025ms
https-1  | rtt min/avg/max/mdev = 0.040/0.216/0.558/0.241 ms
https-1  | =====dig https output====
https-1  | 172.21.0.2
Failing 9:
% RL_VERSION=9 docker-compose up
[+] Running 1/1
 ✔ Container testhttps-https-1  Recreated                                                                                                    0.2s 
Attaching to https-1
https-1  | Rocky Linux 9 - BaseOS                          2.4 MB/s | 2.4 MB     00:00    
...
https-1  | Complete!
https-1  | =====dig version output====
https-1  | DiG 9.16.23-RH
https-1  | =====ping https output====
https-1  | PING https (172.21.0.2) 56(84) bytes of data.
https-1  | 64 bytes from 4a2841b5dac9 (172.21.0.2): icmp_seq=1 ttl=64 time=0.404 ms
https-1  | 64 bytes from 4a2841b5dac9 (172.21.0.2): icmp_seq=2 ttl=64 time=0.117 ms
https-1  | 64 bytes from 4a2841b5dac9 (172.21.0.2): icmp_seq=3 ttl=64 time=0.088 ms
https-1  | 
https-1  | --- https ping statistics ---
https-1  | 3 packets transmitted, 3 received, 0% packet loss, time 2009ms
https-1  | rtt min/avg/max/mdev = 0.088/0.203/0.404/0.142 ms
https-1  | =====dig https output====
https-1  | c.root-servers.net.
https-1  | l.root-servers.net.
https-1  | e.root-servers.net.
https-1  | d.root-servers.net.
https-1  | i.root-servers.net.
https-1  | b.root-servers.net.
https-1  | g.root-servers.net.
https-1  | m.root-servers.net.
https-1  | a.root-servers.net.
https-1  | f.root-servers.net.
https-1  | h.root-servers.net.
https-1  | j.root-servers.net.
https-1  | k.root-servers.net.
Asked by jamshid (384 rep)
Oct 11, 2024, 05:05 PM
Last activity: Oct 11, 2024, 07:45 PM