[英]How to run an Rscript with entrypoint when using docker?
I'm trying to run an Rscript through entrypoint but for some reason when I do this it fails to recognize the file.我正在尝试通过入口点运行 Rscript,但由于某种原因,当我这样做时,它无法识别该文件。 Here is an example.这是一个例子。
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.
The way I can get bash command is through entrypoint for this particular docker.我可以通过此特定 docker 的入口点获取 bash 命令。 Is there anything I can do?有什么我可以做的吗? thanks.谢谢。
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. 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
You would use the form to override the default entrypoint of the docker image.您将使用该表单覆盖 docker 映像的默认入口点。 But the rocker docker image does not set an entrypoint, so the entrypoint is /bin/sh
(found after tracing the base image to ubuntu:focal
).但是摇杆 docker 镜像没有设置入口点,所以入口点是/bin/sh
(在跟踪基础镜像到ubuntu:focal
后找到)。 Because the entrypoint is /bin/sh
, you can simply use Rscript /tmp/test.R
after the docker image.因为入口点是/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.