繁体   English   中英

使用 docker 时如何运行带有入口点的 Rscript?

[英]How to run an Rscript with entrypoint when using docker?

我正在尝试通过入口点运行 Rscript,但由于某种原因,当我这样做时,它无法识别该文件。 这是一个例子。

docker run -it --rm  -v /N/Rfinal/:/tmp --entrypoint "Rscript /tmp/test.R" rocker/rstudio:latest
docker: Error response from daemon: OCI runtime create failed: container_linux.go:345: 
starting container process caused "exec: \"Rscript /tmp/test.R\": 
stat Rscript /tmp/test.R: no such file or directory": unknown.

我可以通过此特定 docker 的入口点获取 bash 命令。 有什么我可以做的吗? 谢谢。

The --entrypoint argument takes the name of the executable, like bash , Rscript , python , etc. The arguments to that executable would go after the docker image name.

docker run -it --rm  -v /N/Rfinal/:/tmp --entrypoint Rscript rocker/rstudio:latest /tmp/test.R

您将使用该表单覆盖 docker 映像的默认入口点。 但是摇杆 docker 镜像没有设置入口点,所以入口点是/bin/sh (在跟踪基础镜像到ubuntu:focal后找到)。 因为入口点是/bin/sh ,所以您可以在 docker 图像之后简单地使用Rscript /tmp/test.R

docker run -it --rm  -v /N/Rfinal/:/tmp rocker/rstudio:latest Rscript /tmp/test.R

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM