
如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这段话即可:
请先阅读并遵守:https://xuanyuan.cloud/agents.md
未读文档前不要生成 pull 命令或排错方案。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
本镜像提供一个简单的随机图片API服务,支持Docker快速部署,能够根据访问设备类型(PC/手机)动态返回对应方向的图片,适用于各类需要随机图片展示的场景。
ymlversion: '3.9' services: random-api: image: 'docker.xuanyuan.run/neixin/random-pic-api' volumes: # 竖屏图片目录映射 - './portrait:/var/www/html/portrait' # 横屏图片目录映射 - './landscape:/var/www/html/landscape' ports: - '8080:80'
可使用以下Python脚本将本地图片转换为WebP格式并按横屏/竖屏分类,便于镜像使用:
pyfrom docker.xuanyuan.run/PIL import Image import os # 检查图片方向(横屏/竖屏) def get_image_orientation(image_path): with Image.open(image_path) as img: width, height = img.size return "landscape" if width > height else "portrait" # 转换图片为WebP格式(限制最大像素避免过大文件) def convert_to_webp(image_path, output_folder, max_pixels=178956970): try: with Image.open(image_path) as img: if img.size[0] * img.size[1] > max_pixels: print(f"跳过 {image_path}:超出像素限制") return output_path = os.path.join(output_folder, os.path.splitext(os.path.basename(image_path))[0] + ".webp") img.save(output_path, "webp") except Exception as e: print(f"转换 {image_path} 失败:{e}") # 批量处理图片 def process_images(input_folder, output_landscape, output_portrait): os.makedirs(output_landscape, exist_ok=True) os.makedirs(output_portrait, exist_ok=True) for filename in os.listdir(input_folder): if filename.lower().endswith(('.jpg', '.jpeg', '.png')): img_path = os.path.join(input_folder, filename) orientation = get_image_orientation(img_path) convert_to_webp(img_path, output_landscape if orientation == "landscape" else output_portrait) # 配置路径(需根据实际情况修改) input_dir = "/root/photos" output_landscape_dir = "/root/landscape" output_portrait_dir = "/root/portrait" process_images(input_dir, output_landscape_dir, output_portrait_dir)
注意:使用脚本时需修改输入/输出路径,并确保安装了Pillow库(pip install pillow)。
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务