
如果你使用 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 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
Docker Traffic Control 可通过标签或HTTP API为Docker容器设置网络速率限制,并模拟延迟、丢包、数据包重复及损坏等网络条件,完全由Bash编写并以Docker镜像形式分发。
该工具通过监听Docker事件,自动对带有指定标签的容器应用网络规则,同时提供HTTP API和命令行界面手动管理规则,帮助开发者测试应用在不同网络环境下的表现。
需使用NET_ADMIN权限和host网络模式,挂载Docker套接字:
bashdocker run -d \ --name docker-tc \ --network host \ --cap-add NET_ADMIN \ --restart always \ -v /var/run/docker.sock:/var/run/docker.sock \ -v /var/docker-tc:/var/docker-tc \ lukaszlach/docker-tc
或使用docker-compose:
bashgit clone https://github.com/lukaszlach/docker-tc.git cd docker-tc docker-compose up -d
为容器添加以下标签启用网络控制:
com.docker-tc.enabled=1:启用规则(必填)com.docker-tc.limit:带宽限制(如1mbps、70.5%)com.docker-tc.delay:延迟(如100ms)com.docker-tc.loss:丢包率(如50%)com.docker-tc.duplicate:数据包重复率(如50%)com.docker-tc.corrupt:数据包损坏率(如10%)示例:
bashdocker network create test-net docker run -it \ --net test-net \ --label "com.docker-tc.enabled=1" \ --label "com.docker-tc.limit=1mbps" \ --label "com.docker-tc.delay=100ms" \ --label "com.docker-tc.loss=50%" \ --label "com.docker-tc.duplicate=50%" \ --label "com.docker-tc.corrupt=10%" \ busybox \ ping google.com
curl localhost:4080/<容器ID或名称>)curl -X LIST localhost:4080)curl -X DELETE localhost:4080/<容器ID或名称>)curl -X PUT localhost:4080/<容器ID或名称>)curl -d'delay=300ms' localhost:4080/<容器ID或名称>)创建别名简化操作:
bashalias docker-tc='curl -sSf -X "$1" "localhost:4080/$2?$3"'
使用示例:
bashdocker-tc get 221517ae59d1 docker-tc set my-container-name 'delay=300ms&rate=1000kbps'
bashgit clone https://github.com/lukaszlach/docker-tc.git cd docker-tc make
由于Docker Swarm限制,暂无法作为服务部署,以下为理论命令:
bashdocker service create \ --name docker-tc \ --mode global \ --restart-condition any \ --network host \ --cap-add NET_ADMIN \ --mount "type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock" \ --mount "type=bind,src=/var/docker-tc,dst=/var/docker-tc" \ lukaszlach/docker-tc
MIT License Copyright (c) 2018 Łukasz Lach <***> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, subject to the conditions specified in the original license.
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务