2

docker 部署 nali 开源 IP 地理信息归属查询软件

 1 year ago
source link: https://www.ioiox.com/archives/166.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

早前用到一个小巧开源的 IP 归属地查询软件,官方提供了 Dockerfile,使用了一段时间觉得还不错,非常简单便捷。

本文为 Stille 原创文章.经实践,测试,整理发布.如需转载请联系作者获得授权,并注明转载地址.

docker 启动

由于该项目会在首次启动自动下载 IP 数据库,所以最好通过挂载目录的方式,将数据库目录挂在到本地,避免每次使用时都会先去下载数据库.

值得注意的是由于官方镜像是将其作为一个单次服务,常规情况下启动容器执行一次就会停止,所以加上了-itd参数确保容器长期存活于后台.后续使用docker exec的方式来获取IP.

示例创建/root/nali用于存放数据库,执行以下命令后台启动容器.

docker run -itd --name nali --restart always \
  -v /root/nali:/root/.local\
  stilleshan/nali

docker 使用

完成上述后台启动容器后,可以执行以下命令来查询IP.

docker exec -it nali /nali 1.1.1.1
# 返回 1.1.1.1 [澳大利亚 APNIC/CloudFlare公共DNS服务器] 

还可以以空格分割同时查询多个地址

docker exec -it nali /nali 1.1.1.1 8.8.8.8

更多用法可以参考官方项目查询使用.


本文为 Stille 原创文章.经实践,测试,整理发布.如需转载请联系作者获得授权,并注明转载地址.

本文链接 https://www.ioiox.com/archives/166.html


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK