【问题标题】:Docker File does not exist:.. ,on UbuntuDocker 文件不存在:..,在 Ubuntu 上
【发布时间】:2019-09-24 11:08:47
【问题描述】:

我有一个 R 管道工服务器,我想使用 docker 容器运行它,到目前为止我的 dockerfile 中有这个配置

FROM rocker/r-ver:3.5.0

#update OS and install linux libraries needed to run plumber
RUN apt-get update -qq && apt-get install -y \
      libssl-dev \
      libcurl4-gnutls-dev

#load in dependencies from 00_Libraries.R file
RUN R -e "install.packages('plumber')"

#Copy all files from current directory
COPY / / 

#Expose port :80 for traffic
EXPOSE 80

#when the container starts, start the runscript.R script
ENTRYPOINT ["Rscript", "runscript.R"]

在我的 runscript.R 文件中,我的服务器配置如下:

pr <- plumber::plumb("/home/kristoffer/Desktop/plumber-api/rfiles/plumber.R")$run(port=8000)

每当我尝试运行 docker 映像时,我都会收到此错误:

 File does not exist: /home/kristoffer/Desktop/plumber-api/rfiles/plumber.R
Execution halted

我已确保所有必要的文件都位于正确的目录中。

编辑: 我在我的目录中包含了所有文件的图像,以确保 dockerfile 与我的其他文件位于同一目录中

【问题讨论】:

  • @LinPy 不幸的是它仍然找不到文件

标签: r docker plumber


【解决方案1】:

您正在复制/ 下的所有内容,请将您的复制命令更改为:

COPY . .

并确保Dockerfile 在同一目录中。

除此之外:

plumber::plumb("/home/kristoffer/Desktop/plumber-api/rfiles/plumber.R")

也将不起作用,因为路径不在您的容器中,请将其更改为:

plumber::plumb("plumber.R")

如果这个文件在同一个目录中

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-03-10
    • 2019-09-15
    • 1970-01-01
    • 1970-01-01
    • 2017-04-29
    • 2014-11-18
    • 2016-04-30
    • 2021-08-11
    相关资源
    最近更新 更多