
如果你使用 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 Docker container provides a Microservice (API Rest) to MAC Address Manufacturer resolution.
This Docker container is part of the "Everything generates Data: Capturing WIFI Anonymous Traffic using Raspberry Pi and WSO2 BAM" blog serie (Part I, Part II & Part III), but you can use it independently as part of other set of Docker containers.
This Docker Container will work in this scenario, as shown below:
!https://github.com/chilcano/docker-mac-address-manuf-lookup/blob/master/chilcano_docker_microservice_mac_address_manuf_lookup_2.png "The MAC Address Manufacturer Lookup Docker Container"
In this first version I have used Python and the next frameworks:
Flask ([***] is a microframework for Python based on Werkzeug and Jinja 2. I will use Flask to implement a mini-web application.SQLAlchemy ([***] is a Python SQL toolkit and ORM.SQLite3 ([***] is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine.pyOpenSSL library to work with X.509 certificates. Required to start the embedded Webserver on HTTPS (TLS).CORS extension for Flask ([***] useful to solve cross-domain Ajax request issues.1) Download the Wireshark Manufacturer file
Download this Github repository.
bash$ git clone https://github.com/chilcano/docker-mac-address-manuf-lookup.git $ cd docker-mac-address-manuf-lookup/python/1.0
Now, to download the Wireshark Manufacturer file.
bash$ python mac_manuf_wireshark_file.py New Manuf file downloaded: manuf/20160220.073718.660_f8866ea289904350b5ff60ffda53edca_ok Cleaned Manuf file created: manuf/20160220.073718.660_f8866ea289904350b5ff60ffda53edca_ok_cleaned TAB Manuf file created: manuf/20160220.073718.660_f8866ea289904350b5ff60ffda53edca_ok_cleaned.tab DB Manuf file created: manuf/20160220.073718.660_f8866ea289904350b5ff60ffda53edca_ok_cleaned.tab.db ( 'mac_address_manuf.db' was created and 28441 rows were loaded into 'MacAddressManuf' table. )
2) Running the Python Microservice
2.1. over HTTP
bash$ python mac_manuf_api_rest.py * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit) * Restarting with stat * Debugger is active! * Debugger pin code: 258-876-642 ... 127.0.0.1 - - [20/Feb/2016 08:38:05] "GET /chilcano/api/manuf/00-50:Ca-ca-fe-ca-fe HTTP/1.1" 400 - 127.0.0.1 - - [20/Feb/2016 08:38:15] "GET /chilcano/api/manuf/00-50:Ca-ca-fe-ca HTTP/1.1" 200 -
And from other Terminal to call the API Rest.
bash$ curl -i http://127.0.0.1:5000/chilcano/api/manuf/00-50:Ca-ca-fe-ca-fe HTTP/1.0 400 BAD REQUEST Content-Type: application/json Content-Length: 68 Server: Werkzeug/0.11.4 Python/2.7.11 Date: Sat, 20 Feb 2016 07:38:05 GMT { "error": "The MAC Address '00-50:Ca-ca-fe-ca-fe' is malformed" } $ curl -i http://127.0.0.1:5000/chilcano/api/manuf/00-50:Ca-ca-fe-ca HTTP/1.0 200 OK Content-Type: application/json Content-Length: 93 Server: Werkzeug/0.11.4 Python/2.7.11 Date: Sat, 20 Feb 2016 07:38:15 GMT { "mac": "00:50:CA", "manuf": "NetToNet", "manuf_desc": "# NET TO NET TECHNOLOGIES" }
2.2. Over HTTPS
pyOpenSSL moodule was required to start the embedded Webserver on HTTPS (TLS).
To install it just run pip install pyOpenSSL.
Then, the Python App is running over HTTPS:
bash$ python mac_manuf_api_rest.py * Running on https://0.0.0.0:5443/ (Press CTRL+C to quit) * Restarting with stat * Debugger is active! * Debugger pin code: 258-876-642
And calling the API:
bash$ curl -ik https://127.0.0.1:5443/chilcano/api/manuf/00-50:Ca-ca-fe-ca HTTP/1.0 200 OK Content-Type: application/json Content-Length: 93 Server: Werkzeug/0.11.4 Python/2.7.11 Date: Mon, 29 Feb 2016 15:58:21 GMT { "mac": "00:50:CA", "manuf": "NetToNet", "manuf_desc": "# NET TO NET TECHNOLOGIES" }
3) Running everything into a Docker container
3.1. Clonning the Github repository and Building the container
bash$ git clone https://github.com/chilcano/docker-mac-address-manuf-lookup.git $ cd docker-mac-address-manuf-lookup $ docker build --rm -t chilcano/mac-manuf-lookup-py:1.0 python/1.0/. $ docker build --rm -t chilcano/mac-manuf-lookup-py:1.1 python/1.1/. $ docker build --rm -t chilcano/mac-manuf-lookup-py:1.2 python/1.2/. $ docker build --rm -t chilcano/mac-manuf-lookup-py:latest python/latest/.
3.2. Pull from Docker Hub
bash$ docker pull chilcano/mac-manuf-lookup-py
3.3. Run and check the container
bash$ docker run -dt --name=mac-manuf-py-12 -p 5000:5000/tcp -p 5443:5443/tcp chilcano/mac-manuf-lookup-py:1.2 $ docker run -dt --name=mac-manuf-py-latest -p 5000:5000/tcp -p 5443:5443/tcp chilcano/mac-manuf-lookup-py:latest $ docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 0d5c2df25520 chilcano/mac-manuf-lookup-py:latest "/bin/sh -c 'pytho..." 8 seconds ago Up 6 seconds 0.0.0.0:5000->5000/tcp, 0.0.0.0:5443->5443/tcp mac-manuf-py-latest
3.4. Gettting SSH access to the Container to check if SQLite DB exists
bash$ docker exec -ti mac-manuf-py-12 bash $ docker exec -ti mac-manuf-py-latest bash
4) Testing
Calling the Microservice (API Rest).
bash$ curl -i http://localhost:5000/chilcano/api/manuf/00-50:Ca-ca-fe-ca HTTP/1.0 200 OK Content-Type: application/json Content-Length: 93 Server: Werkzeug/0.11.4 Python/2.7.11 Date: Sat, 20 Feb 2016 09:01:38 GMT { "mac": "00:50:CA", "manuf": "NetToNet", "manuf_desc": "# NET TO NET TECHNOLOGIES" }
If the embedded server was started on HTTPS, you could test it as shown below.
bash$ curl -ik https://localhost:5443/chilcano/api/manuf/00-50:Ca-ca-fe-ca HTTP/1.0 200 OK Content-Type: application/json Content-Length: 93 Server: Werkzeug/0.11.4 Python/2.7.11 Date: Mon, 29 Feb 2016 15:58:21 GMT { "mac": "00:50:CA", "manuf": "NetToNet", "manuf_desc": "# NET TO NET TECHNOLOGIES" }
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务