
如果你使用 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 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
基于官方 AstrBot 重新打包的优化版 Docker 镜像。
官方原版镜像在数据挂载层面将过多内容交给了外部 Volume,容易导致插件依赖损坏和环境变得不易维护。本镜像遵循 Docker 容器化“不可变基础设施”的最高实践标准,将环境依赖与业务数据严格分离,为您提供一个真正的开箱即用、长期且稳定的 AstrBot 服务。
plugins 的路径(将它移出数据挂载卷 volume 而打包进镜像本体内)。确保应用代码与用户数据(/app/data)分离。setuptools 版本固定在 <82,规避由于依赖漂移导致的构建与运行错误。【极度不建议】在容器启动后,通过 WebUI 或进入容器拉取更新 Dashboard,或者手动安装其他新插件!
手动安装插件或修改程序本体会 严重破坏 镜像内置的全局依赖树,使应用失去 Docker 环境提供的「隔离性」和「可复现性」。 如果您确实需要添加新插件或更新版本,请 自定义修改 Dockerfile 然后重新构建镜像,而不是在运行时的容器内进行热修改。
创建 docker-compose.yml 文件:
yamlservices: astrbot: image: docker.xuanyuan.run/mioyisama/astrbot:v4.25.0 # 替换为您实际推送到 Hub 的镜像名称 container_name: astrbot restart: unless-stopped networks: - astrbot volumes: - ./data:/app/data - /etc/localtime:/etc/localtime:ro networks: astrbot: name: astrbot
随后执行启动命令即可享用:
bashdocker compose up -d
如果您希望更换绑定的 AstrBot 版本,或是想要在镜像中固化更多您喜欢的插件,可以克隆本仓库的 Dockerfile 并按需调整参数重新打包。
构建命令示例:
bash# 默认构建 docker build -t astrbot:v4.24.5 -t astrbot:latest . # 指定构建版本 docker build -t astrbot:v4.24.5 -t astrbot:latest --build-arg VERSION=v4.24.5 .
附录:如何添加自己的固化插件?
在 Dockerfile 末尾,参考已有插件的安装格式添加对应的语句:
dockerfileRUN --mount=type=cache,target=/root/.cache/uv \ git clone --depth 1 https://github.com/作者/您的目标插件.git plugins/目标插件 \ && rm -rf plugins/目标插件/.git \ && uv pip install -r plugins/目标插件/requirements.txt
附:Dockerfile
dockerfileFROM ghcr.io/astral-sh/uv:python3.13-trixie-slim # docker build -t astrbot:v4.24.5 -t astrbot:latest --build-arg VERSION=v4.24.5 . ARG VERSION=v4.24.5 ENV UV_SYSTEM_PYTHON=1 \ UV_LINK_MODE=copy # 安装系统依赖 RUN DEBIAN_FRONTEND=noninteractive apt-get update \ && apt-get install -y --no-install-recommends git curl unzip \ && rm -rf /var/lib/apt/lists/* # 克隆AstrBot代码库 RUN git clone --depth 1 --branch ${VERSION} --single-branch \ https://github.com/AstrBotDevs/AstrBot.git /app \ && rm -rf /app/.git WORKDIR /app # 下载并解压WebUI RUN curl -L https://github.com/AstrBotDevs/AstrBot/releases/download/${VERSION}/AstrBot-${VERSION}-dashboard.zip -o dashboard.zip \ && unzip dashboard.zip -d webui \ && rm dashboard.zip # 安装依赖 RUN --mount=type=cache,target=/root/.cache/uv \ uv pip install 'setuptools<82' \ && uv pip install -r requirements.txt RUN mkdir plugins && mkdir data RUN --mount=type=cache,target=/root/.cache/uv \ git clone --depth 1 https://github.com/lxfight/astrbot_plugin_mnemosyne plugins/astrbot_plugin_mnemosyne \ && rm -rf plugins/astrbot_plugin_mnemosyne/.git \ && uv pip install -r plugins/astrbot_plugin_mnemosyne/requirements.txt RUN --mount=type=cache,target=/root/.cache/uv \ git clone --depth 1 https://github.com/anka-afk/astrbot_plugin_meme_manager plugins/astrbot_plugin_meme_manager \ && rm -rf plugins/astrbot_plugin_meme_manager/.git \ && uv pip install -r plugins/astrbot_plugin_meme_manager/requirements.txt RUN --mount=type=cache,target=/root/.cache/uv \ git clone --depth 1 https://github.com/zouyonghe/astrbot_plugin_web_searcher_pro plugins/astrbot_plugin_web_searcher_pro \ && rm -rf plugins/astrbot_plugin_web_searcher_pro/.git \ && uv pip install -r plugins/astrbot_plugin_web_searcher_pro/requirements.txt RUN --mount=type=cache,target=/root/.cache/uv \ git clone --depth 1 https://github.com/DBJD-CR/astrbot_plugin_proactive_chat plugins/astrbot_plugin_proactive_chat \ && rm -rf plugins/astrbot_plugin_proactive_chat/.git \ && uv pip install -r plugins/astrbot_plugin_proactive_chat/requirements.txt RUN printf '%s\n' \ '#!/bin/sh' \ 'set -e' \ 'cd /app' \ 'ln -sfT /app/plugins /app/data/plugins' \ 'exec "$@"' \ > /usr/local/bin/docker-entrypoint.sh \ && chmod +x /usr/local/bin/docker-entrypoint.sh EXPOSE 6185 VOLUME [ "/app/data" ] ENTRYPOINT [ "docker-entrypoint.sh" ] CMD [ "python", "main.py", "--webui-dir", "webui/dist" ]
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务