
如果你使用 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 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
github:https://github.com/AFAN-LIFE/R-Executor
Author: AFAN (WeChat: afan-life)
R-Executor是基于Docker的R语言执行环境,集成了R运行时和Python Flask服务。用户可通过HTTP请求向r-executor容器发送R代码执行并获取结果,旨在提供跨平台R语言调用方案,简化R代码的远程执行与结果获取流程。
rpy2将R数据类型转换为标准Python数据类型,支持HTTP结果解析。从Docker Hub拉取镜像
r-executor镜像已发布至Docker Hub,可直接拉取:
bashdocker pull docker.xuanyuan.run/afanlife/r-executor
镜像地址:https://hub.docker.com/r/afanlife/r-executor
镜像预装Python 3.13.2、R 4.4.2及requirements.txt、r_packages.txt中列出的依赖。容器内通过卷挂载执行app.py,可直接修改无需重建镜像。
重建镜像
若默认版本不满足需求,可修改相关文件后重建:
Dockerfile。requirements.txt(Python)和r_packages.txt(R)。
重建命令:bashdocker build -t r-executor:1.0 .
镜像导出/加载命令:
bashdocker save -o r-executor.tar r-executor docker load -i r-executor.tar
将当前目录所有文件映射至容器/app目录并启动服务:
手动启动
bashdocker run -it -p 5000:5000 -v .:/app docker.xuanyuan.run/afanlife/r-executor /bin/bash python app.py
使用Docker Compose
bashdocker compose up
app.pyroot@9f2585313bab:/app# Python app.py 3.5.17 * Serving Flask app 'app' * Debug mode: on WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. * Running on all addresses (0.0.0.0) * Running on http://127.0.0.1:5000 * Running on http://172.17.0.2:5000 Press CTRL+C to quit * Restarting with stat
test1_basic.py(基础数据类型测试)json{ "data": { "dataframe": { "a": [1.0, 2.0], "b": ["x", "y"] }, "matrix": [1, 2, 3, 4], "vector": [1.0, 2.0, 3.0] }, "message": "R code run success", "status": "success" }
test2_lrm.py(逻辑回归模型测试)json{ "data": { "accuracy": [0.991], "model_summary": [ "Logistic Regression Model", "", "lrm(formula = Heart_Disease ~ ., data = r_df)", "", " Model Likelihood Discrimination Rank Discrim. ", " Ratio Test Indexes Indexes ", "Obs 1000 LR chi2 238.07 R2 0.859 C 0.997 ", " 0 968 d.f. 4 R2(4,1000)0.209 Dxy 0.994 ", " 1 32 Pr(> chi2) <0.0001 R2(4,92.9)0.919 gamma 0.994 ", "max |deriv| 2e-05 Brier 0.007 tau-a 0.062 ", "", " Coef S.E. Wald Z Pr(>|Z|)", "Intercept -109.6707 24.8000 -4.42 <0.0001 ", "Age 0.4953 0.1116 4.44 <0.0001 ", "Blood_Sugar 0.5558 0.1228 4.52 <0.0001 ", "Blood_Pressure 0.0135 0.0213 0.63 0.5270 ", "Weight 0.0647 0.0307 2.11 0.0352 ", "" ] }, "message": "R code run success", "status": "success" }
test3_plot.py(图表生成测试)您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务