使用 whois 命令的 Bash 脚本在 docker 上出现 "Servname not supported..."错误

标签 bash docker whois

这是我的第一个 Docker 镜像,我将自己的 bash 脚本放在那里。此脚本使用 whois命令。 docker 运行我的脚本后,出现了一些错误。可能我在我的 dockerfile 上犯了错误。脚本在我的 ubuntu 上运行良好。
我应该添加 /etc/services文件到我的图像?

Dockerfile:

FROM ubuntu
ADD ./ip_info /usr/src/ip_info
ADD ./ip_info /bin/ip_info
RUN apt-get update &&  apt-get -y install whois
RUN chmod +x /usr/src/ip_info
CMD ["/usr/src/ip_info"]

错误:
getaddrinfo(whois.ripe.net): Servname not supported for ai_socktype

最佳答案

我修好了

RUN apt-get update && apt-get install -y --no-install-recommends ntp

到 dockerfile。

关于使用 whois 命令的 Bash 脚本在 docker 上出现 "Servname not supported..."错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56430294/

相关文章:

linux - eval 和 export 从字符串中删除双引号 (")

无法在 C 中使用 system() 函数执行 "cat"

Bash,没有取消的 Zenity 进度条

docker - 如何将参数从文件传递给dockerfile

whois - Python Whois 问题

php - 减少 whois 查询负担的策略

c++ - WHOIS 中的奇怪网络路径

bash - 这些文件描述符关闭的目的是什么?

json - Docker - 使用 SystemD 和 "daemon.json"启用远程 HTTP API

docker - 您如何使用 docker-compose v3.1 管理 secret 值?