Docker文件不存在:,在Ubuntu上
我有一个R plumber服务器,我想使用docker容器运行它,到目前为止,我在我的Docker文件不存在:,在Ubuntu上,r,docker,plumber,R,Docker,Plumber,我有一个R plumber服务器,我想使用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
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)
我已确保所有必要的文件都位于正确的目录中
编辑:
我在目录中包含了所有文件的图像,以确保dockerfile与我的其他文件位于同一目录中您正在复制
/
下的所有文件将复制命令更改为:
COPY . .
并确保Dockerfile
位于同一目录中
除此之外:
plumber::plumb("/home/kristoffer/Desktop/plumber-api/rfiles/plumber.R")
也将不起作用,因为路径不在容器中。请将其更改为:
plumber::plumb("plumber.R")
如果此文件位于同一目录中@LinPy,很遗憾,它仍然找不到该文件
plumber::plumb("plumber.R")