抱歉,我不知道这是 docker 问题还是 rockylinux 9 上的 dig 问题。在 rockylinux 8 上一切都按预期运行。
我有一个docker-compose.yml
名为的文件,其中包含一个名为 的服务https
。这允许通过主机名 引用容器https
。虽然ping https
可以工作,但由于某种原因dig https
(DiG 9.16.23-RH
)在 rockylinux 9 上不起作用。它在 rockylinux 8 上可以工作(DiG 9.11.36-RedHat-9.11.36-16.el8_10.2
)。如果我将服务名称更改为httpsx
然后dig httpsx
就可以工作。
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
工作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
失败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.