
如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
This is a pre-configured, ready-to-run MongoDB server with IP2Location Geolocation database setup scripts. It simplifies the development team to install and set up the IP2Location geolocation database in MongoDB server. The setup script supports the commercial database packages and free LITE package. Please register for a free or commercial account before running this image, as it requires a download token during the setup process.
This docker image supports the IP2Location (DB1 to DB26) database.
Create a dedicated network so that your application containers can communicate with the IP2Location container by name.
bashdocker network create ip2location-network
Run this image as daemon using the download token and product code from IP2Location LITE or IP2Location and attaching it to the network created above.
bashdocker run --name ip2location \ --network ip2location-network \ -d \ -e TOKEN={DOWNLOAD_TOKEN} \ -e CODE={DOWNLOAD_CODE} \ -e MONGODB_PASSWORD={MONGODB_PASSWORD} \ ip2location/mongodb
ENV Variables
TOKEN - Download token obtained from IP2Location.
CODE - The CSV file download code. You may get the download code from your account panel.
MONGODB_PASSWORD - Password for MongoDB admin.
The installation may take seconds to minutes depending on your database sizes, downloading speed and hardware specs. You may check the installation status by viewing the container logs. Run the below command to check the container log:
docker logs -f ip2location
You should see the line > Setup completed if you have successfully completed the installation.
Run your application container on the same network. The IP2Location container is reachable by its container name (ip2location) as the hostname:
bashdocker run --network ip2location-network -t -i {YOUR_APPLICATION}
In your application container, install MongoDB and Mongo Shell first by following the installation steps in https://docs.mongodb.com/manual/tutorial/install-mongodb-on-debian/.
Run the Mongo Shell with the password you've specified during the installation and connect to ip2location host.
bashmongosh --host ip2location -u mongoAdmin -p {MONGODB_PASSWORD} --authenticationDatabase admin
To test the IPv4 database, key in the commands below to query geolocation info for IPv4 address 8.8.8.8 (IP number: ***).
bashuse ip2location_database db.ip2location_database.findOne( { ip_to: { $gte: 134744072 } } )
To test the IPv6 database, key in the commands below to query geolocation info for IPv6 address 2001:4860:4860::8888 (IP number: 42541956123769884636017138956568135816).
bashuse ip2location_database db.ip2location_database.findOne( { ip_to_index: { $gte: "A0042541956123769884636017138956568135816" } } )
If you don't know how to convert an IP address to IP number, please see IP2Location FAQs.
NOTES: The search param for IPv4 database is a number BUT the param for IPv6 database is a string of the IP number left-padded with zeroes till 40 characters and prefixed with an "A".
Also, IPv6 database is filtering on the ip_to_index field while IPv4 database is filtering on the ip_to field.
When querying IPv4 address using the IPv6 database, you need to convert the IPv4 address into IPv4-mapped IPv6 address before converting to IP number.
To update your IP2Location database to latest version, please run the following command:
bashdocker exec -it ip2location ./update.sh
You can visit the below link for more information about this docker image: IP2Location Articles and Tutorials
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务
以下是 ip2location/mongodb 相关的常用 Docker 镜像,适用于 不同场景 等不同场景: