1\uff1a\u8f7b\u677e\u5f00\u53d1<\/strong><\/div>\nOpenCPU \u7cfb\u7edf\u7684\u65d7\u8230\u662f OpenCPU \u670d\u52a1\u5668\uff1a\u5b83\u662f\u4e00\u4e2a\u6210\u719f\u4e14\u5f3a\u5927\u7684 Linux \u6808\uff0c\u7528\u4e8e\u5728\u7cfb\u7edf\u548c\u5e94\u7528\u7a0b\u5e8f\u4e2d\u5d4c\u5165 R\u3002\u56e0\u4e3a OpenCPU \u662f\u5b8c\u5168\u5f00\u6e90\u7684\uff0c\u6211\u4eec\u53ef\u4ee5\u5728 DockerHub \u4e0a\u6784\u5efa\u548c\u53d1\u5e03\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u542f\u52a8\u4e00\u4e2a\u53ef\u4ee5\u7acb\u5373\u4f7f\u7528\u7684 OpenCPU \u548c RStudio \u7684 Linux \u670d\u52a1\u5668\uff08\u4f7f\u7528\u7aef\u53e3 8004 \u6216 80\uff09\uff1a<\/p>\n
docker run -t -p 8004:8004 opencpu\/rstudio<\/pre>\n\u73b0\u5728\u53ea\u9700\u5728\u4f60\u7684\u6d4f\u89c8\u5668\u6253\u5f00 http:\/\/localhost:8004\/ocpu\/ \u548c http:\/\/localhost:8004\/rstudio\/ \u5373\u53ef\uff01\u5728 rstudio \u4e2d\u7528\u7528\u6237 opencpu\uff08\u5bc6\u7801\uff1aopencpu\uff09\u767b\u5f55\u6765\u6784\u5efa\u6216\u5b89\u88c5\u5e94\u7528\u7a0b\u5e8f\u3002\u6709\u5173\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2\u9605\u81ea\u8ff0\u6587\u4ef6\u3002<\/p>\n
Docker \u8ba9\u5f00\u59cb\u4f7f\u7528 OpenCPU \u53d8\u5f97\u7b80\u5355\u3002\u5bb9\u5668\u7ed9\u4f60\u4e00\u4e2a\u5145\u5206\u7075\u6d3b\u7684 Linux \u673a\u5668\uff0c\u800c\u65e0\u9700\u5728\u7cfb\u7edf\u4e0a\u5b89\u88c5\u4efb\u4f55\u4e1c\u897f\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7 rstudio \u670d\u52a1\u5668\u5b89\u88c5\u8f6f\u4ef6\u5305\u6216\u5e94\u7528\u7a0b\u5e8f\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528 docker exec \u8fdb\u5165\u5230\u6b63\u5728\u8fd0\u884c\u7684\u670d\u52a1\u5668\u7684 root shell \u4e2d\uff1a<\/p>\n
# Lookup the container ID\r\ndocker ps\r\n# Drop a shell\r\ndocker exec -i -t eec1cdae3228 \/bin\/bash<\/pre>\n\u4f60\u53ef\u4ee5\u5728\u670d\u52a1\u5668\u7684 shell \u4e2d\u5b89\u88c5\u5176\u4ed6\u8f6f\u4ef6\uff0c\u81ea\u5b9a\u4e49 apache2 \u7684 httpd \u914d\u7f6e\uff08auth\uff0c\u4ee3\u7406\u7b49\uff09\uff0c\u8c03\u6574 R \u9009\u9879\uff0c\u901a\u8fc7\u9884\u52a0\u8f7d\u6570\u636e\u6216\u5305\u7b49\u6765\u4f18\u5316\u6027\u80fd\u3002<\/p>\n
2\uff1a \u901a\u8fc7 DockerHub \u53d1\u5e03\u548c\u90e8\u7f72<\/strong><\/div>\n\u6700\u5f3a\u5927\u7684\u662f\uff0cDocker \u53ef\u4ee5\u901a\u8fc7 DockerHub \u53d1\u5e03\u548c\u90e8\u7f72\u3002\u8981\u521b\u5efa\u4e00\u4e2a\u5b8c\u5168\u72ec\u7acb\u7684\u5e94\u7528\u7a0b\u5e8f\u5bb9\u5668\uff0c\u53ea\u9700\u4f7f\u7528\u6807\u51c6\u7684 opencpu \u955c\u50cf\u5e76\u6dfb\u52a0\u4f60\u7684\u7a0b\u5e8f\u3002<\/p>\n
\u51fa\u4e8e\u672c\u6587\u7684\u76ee\u7684\uff0c\u6211\u901a\u8fc7\u5728\u6bcf\u4e2a\u4ed3\u5e93\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u975e\u5e38\u7b80\u5355\u7684 \u201cDockerfile\u201d\uff0c\u5c06\u4e00\u4e9b\u793a\u4f8b\u7a0b\u5e8f\u6253\u5305\u4e3a docker \u5bb9\u5668\u3002\u4f8b\u5982\uff1anabel \u7684 Dockerfile \u5305\u542b\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n
FROM opencpu\/base\r\nRUN R -e 'devtools::install_github(\"rwebapps\/nabel\")'<\/pre>\n\u5b83\u91c7\u7528\u6807\u51c6\u7684 opencpu\/base \u955c\u50cf\uff0c\u5e76\u4ece Github \u4ed3\u5e93\u5b89\u88c5 nabel\u3002\u6700\u7ec8\u5f97\u5230\u4e00\u4e2a\u5b8c\u5168\u9694\u79bb\u3001\u72ec\u7acb\u7684\u7a0b\u5e8f\u3002\u4efb\u4f55\u4eba\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u8fd9\u6837\u7684\u547d\u4ee4\u542f\u52a8\u7a0b\u5e8f\uff1a<\/p>\n
docker run -d 8004:8004 rwebapps\/nabel<\/pre>\n-d \u4ee3\u8868\u5b88\u62a4\u8fdb\u7a0b\u76d1\u542c 8004 \u7aef\u53e3\u3002\u5f88\u663e\u7136\uff0c\u4f60\u53ef\u4ee5\u8c03\u6574 Dockerfile \u6765\u5b89\u88c5\u4efb\u4f55\u5176\u5b83\u7684\u8f6f\u4ef6\u6216\u8bbe\u7f6e\u4f60\u9700\u8981\u7684\u7a0b\u5e8f\u3002<\/p>\n
\u5bb9\u5668\u5316\u90e8\u7f72\u5c55\u793a\u4e86 Docker \u7684\u771f\u6b63\u80fd\u529b\uff1a\u5b83\u53ef\u4ee5\u53d1\u5e03\u53ef\u4ee5\u5f00\u7bb1\u5373\u7528\u7684\u72ec\u7acb\u8f6f\u4ef6\uff0c\u800c\u65e0\u9700\u5b89\u88c5\u4efb\u4f55\u8f6f\u4ef6\u6216\u4f9d\u8d56\u4ed8\u8d39\u6258\u7ba1\u7684\u670d\u52a1\u3002\u5982\u679c\u4f60\u66f4\u559c\u6b22\u4e13\u4e1a\u7684\u6258\u7ba1\uff0c\u90a3\u4f1a\u6709\u8bb8\u591a\u516c\u53f8\u4e50\u610f\u5728\u53ef\u6269\u5c55\u7684\u57fa\u7840\u8bbe\u65bd\u4e0a\u4e3a\u4f60\u6258\u7ba1 docker \u7a0b\u5e8f\u3002<\/p>\n
3\uff1a \u8de8\u5e73\u53f0\u6784\u5efa<\/strong><\/div>\n\u8fd8\u6709 Docker \u7528\u4e8e OpenCPU \u7684\u7b2c\u4e09\u79cd\u65b9\u5f0f\u3002\u6bcf\u6b21\u53d1\u5e03\uff0c\u6211\u4eec\u90fd\u6784\u5efa 6 \u4e2a\u64cd\u4f5c\u7cfb\u7edf\u7684 opencpu-server \u5b89\u88c5\u5305\uff0c\u5b83\u4eec\u5728 https:\/\/archive.opencpu.org \u4e0a\u516c\u5e03\u3002\u8fd9\u4e2a\u8fc7\u7a0b\u5df2\u7ecf\u4f7f\u7528 DockerHub \u5b8c\u5168\u81ea\u52a8\u5316\u4e86\u3002\u4ee5\u4e0b\u955c\u50cf\u4ece\u6e90\u4ee3\u7801\u81ea\u52a8\u6784\u5efa\u6240\u6709\u6808\uff1a<\/p>\n
\n- opencpu\/ubuntu-16.04<\/li>\n
- opencpu\/debian-9<\/li>\n
- opencpu\/fedora-25<\/li>\n
- opencpu\/fedora-26<\/li>\n
- opencpu\/centos-6<\/li>\n
- opencpu\/centos-7<\/li>\n<\/ul>\n
\u5f53 GitHub \u4e0a\u53d1\u5e03\u65b0\u7248\u672c\u65f6\uff0cDockerHub \u4f1a\u81ea\u52a8\u91cd\u5efa\u6b64\u955c\u50cf\u3002\u8981\u505a\u7684\u5c31\u662f\u8fd0\u884c\u4e00\u4e2a\u811a\u672c\uff0c\u5b83\u4f1a\u53d6\u56de\u955c\u50cf\u5e76\u5c06 opencpu-server \u4e8c\u8fdb\u5236\u590d\u5236\u5230\u5f52\u6863\u670d\u52a1\u5668\u4e0a\u3002<\/p>\n
via: https:\/\/www.r-bloggers.com\/why-use-docker-with-r-a-devops-perspective\/<\/p>\n
\u4f5c\u8005\uff1aJeroen Ooms \u8bd1\u8005\uff1ageekpi \u6821\u5bf9\uff1awxy<\/p>\n
\u672c\u6587\u7531 LCTT \u539f\u521b\u7f16\u8bd1\uff0cLinux\u4e2d\u56fd \u8363\u8a89\u63a8\u51fa<\/p>\n
\n\u539f\u6587\u6765\u81ea\uff1ahttps:\/\/linux.cn\/article-9023-1.html<\/a><\/p>\n
\u672c\u6587\u5730\u5740\uff1ahttp:\/\/gulass.cn\/docker-use-r.html<\/a>\u7f16\u8f91\uff1a\u9ad8\u519b\uff0c\u5ba1\u6838\u5458\uff1a\u9004\u589e\u5b9d<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"
\u5bfc\u8bfb R \u8bed\u8a00\uff0c\u4e00\u79cd\u81ea\u7531\u8f6f\u4ef6\u7f16\u7a0b\u8bed\u8a00\u4e0e\u64cd\u4f5c\u73af\u5883\uff0c\u4e3b\u8981\u7528\u4e8e\u7edf\u8ba1\u5206\u6790\u3001\u7ed8\u56fe\u3001\u6570\u636e\u6316\u6398\u3002R \u5185\u7f6e\u591a\u79cd\u7edf\u8ba1\u5b66\u53ca\u6570\u5b57\u5206\u6790 […]<\/p>\n","protected":false},"author":63,"featured_media":87205,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-87201","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/87201","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/users\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/comments?post=87201"}],"version-history":[{"count":4,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/87201\/revisions"}],"predecessor-version":[{"id":87244,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/87201\/revisions\/87244"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media\/87205"}],"wp:attachment":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media?parent=87201"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/categories?post=87201"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/tags?post=87201"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}