R与docker:-未安装自定义软件包

时间:2020-06-10 18:55:09

标签: r dockerfile docker-build

我的项目中有下面的docker文件。

在dockerfile中,我指定了用于安装自定义软件包(myPackage_1.0.tar.gz)的命令,但安装没有发生

# start from the rocker/r-ver:4.0.0 image
FROM rocker/r-ver:4.0.0

# install the linux libraries needed for plumber
RUN apt-get update -qq && apt-get install -y \
  libssl-dev \
  libcurl4-gnutls-dev

# install plumber
RUN R -e "install.packages('plumber')"

# below line is only for testing the API with package
RUN R -e "install.packages('/home/rockstar/myPackage_1.0.tar.gz', repos = NULL, type = 'source')"


# copy everything from the current directory into the container
COPY / /

# open port 80 to traffic
EXPOSE 80

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

当我执行docker build -t onee .时遇到错误

rockstar@rockstar:~/Downloads/R-controller-master$ sudo docker build -t onee .
Sending build context to Docker daemon  40.96kB
Step 1/7 : FROM rocker/r-ver:4.0.0
 ---> 2e7d8316de40
Step 2/7 : RUN apt-get update -qq && apt-get install -y   libssl-dev   libcurl4-gnutls-dev
 ---> Using cache
 ---> 92921fe16641
Step 3/7 : RUN R -e "install.packages('plumber')"
 ---> Using cache
 ---> a07f89e20214
Step 4/7 : RUN R -e "install.packages('/home/rockstar/myPackage_1.0.tar.gz', repos = NULL, type = 'source')"
 ---> Running in f6079ea2cfe7

R version 4.0.0 (2020-04-24) -- "Arbor Day"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> install.packages('/home/rockstar/myPackage_1.0.tar.gz', repos = NULL, type = 'source')
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
Warning: invalid package ‘/home/rockstar/myPackage_1.0.tar.gz’
Error: ERROR: no packages specified
Warning message:
In install.packages("/home/rockstar/myPackage_1.0.tar.gz",  :
  installation of package ‘/home/rockstar/myPackage_1.0.tar.gz’ had non-zero exit status
> 
> 
Removing intermediate container f6079ea2cfe7
 ---> 5f2634b9680a
Step 5/7 : COPY / /
 ---> fbc421cfc2e2
Step 6/7 : EXPOSE 80
 ---> Running in 85ec6a2c76d6
Removing intermediate container 85ec6a2c76d6
 ---> 30b6a2f388ec
Step 7/7 : ENTRYPOINT ["Rscript", "main.R"]
 ---> Running in c99dc2f986f4
Removing intermediate container c99dc2f986f4
 ---> 29a382f7df0f
Successfully built 29a382f7df0f
Successfully tagged onee:latest

基于该错误,我开发的软件包无法安装。

有人可以帮我吗

0 个答案:

没有答案