Closed LHSFK closed 4 months ago
CentOS 下使用 nattertool/natter
是正确的。
建议使用以下命令打开详细输出,以方便检查问题:
docker run --rm --net=host nattertool/natter -v
错误原因是主机名解析失败了,可以检查以下几个问题:
hostname -A
回车,返回的是服务器的所有主机名。逐一 ping 检查,如果有问题则在 /etc/hosts
内自行添加。后续版本会优化相关流程,忽略这种非致命错误。
系统:CentOS Linux 7 (Core) 内核: 5.4.269-1.el7.elrepo.x86_64
[root@centos ~]# docker run --rm --net=host nattertool/natter -v
Unable to find image 'nattertool/natter:latest' locally
latest: Pulling from nattertool/natter
6a299ae9cfd9: Pull complete
9cfac61cdeb0: Pull complete
51eec3c576b2: Pull complete
Digest: sha256:9017fb434d540b694d091769735115869d7e9be9d8fc654a53e4298590b1892c
Status: Downloaded newer image for nattertool/natter:latest
2024-02-25 09:21:54 [I] Natter v2.0.0-rc2
Traceback (most recent call last):
File "/opt/natter.py", line 1491, in <module>
main()
File "/opt/natter.py", line 1482, in main
natter_main(show_title)
File "/opt/natter.py", line 1354, in natter_main
check_docker_network()
File "/opt/natter.py", line 1100, in check_docker_network
ipaddr = socket.gethostbyname(fqdn)
^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno -2] Name or service not known
dns正常
[root@centos ~]# nslookup baidu.com
Server: 10.0.1.2
Address: 10.0.1.2#53
Non-authoritative answer:
Name: baidu.com
Address: 39.156.66.10
Name: baidu.com
Address: 110.242.68.66
主机名也正常
[root@centos ~]# hostname -A
centos centos centos centos centos centos centos
[root@centos ~]# ping centos
PING centos (172.16.0.20) 56(84) bytes of data.
64 bytes from centos (172.16.0.20): icmp_seq=1 ttl=64 time=0.114 ms
64 bytes from centos (172.16.0.20): icmp_seq=2 ttl=64 time=0.085 ms
刚刚优化了相关流程,请使用 nattertool/natter:dev
开发分支镜像验证,看看是否解决了问题:
docker run --rm --net=host nattertool/natter:dev -v
好了,问题解决了
默认的latest版,报错