在Docker中安装Rcpp包会导致安装过程中出现冻结



我正在安装一个R Shiny应用程序,但我无法再运行安装。

这是我的Dockerfile

FROM openanalytics/r-base
# system libraries of general use
RUN apt-get update && apt-get install -y 
sudo 
pandoc 
pandoc-citeproc 
libcurl4-gnutls-dev 
libcairo2-dev 
libxt-dev 
libssl-dev 
libssh2-1-dev 
libssl1.0.0
# system library dependency for the app
RUN apt-get update && apt-get install -y 
libxml2-dev
RUN R -e "install.packages(c('data.table','janitor','snakecase'), repos='https://cloud.r-project.org/')"
RUN R -e "install.packages('https://cran.r-project.org/src/contrib/Archive/dplyr/dplyr_0.8.2.tar.gz', repos=NULL, type='source')"
RUN R -e "install.packages('https://cran.r-project.org/src/contrib/Archive/shiny/shiny_1.3.0.tar.gz', repos=NULL, type='source')"
# copy the app to the image
RUN mkdir /root/corona
COPY app /root/corona
COPY Rprofile.site /usr/lib/R/etc/
EXPOSE 3838
CMD ["R", "-e shiny::runApp('/root/corona', options = list(port = '3838'))"]

构建图像只是冻结,总是在这条线上:

* installing *source* package ‘R6’ ...
** package ‘R6’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (R6)
* installing *source* package ‘Rcpp’ ...
** package ‘Rcpp’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I../inst/include/     -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-ttHamR/r-base-4.0.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c api.cpp -o api.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I../inst/include/     -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-ttHamR/r-base-4.0.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c attributes.cpp -o attributes.o

任何有类似问题的人都可以告诉我为什么会发生这种情况?

我试着从源代码安装软件包,尝试了另一个版本,但它总是一样的。这是与Docker相关的问题还是与包相关的问题?

还尝试从那里安装:install.packages("Rcpp", repos="https://rcppcore.github.io/drat")

如果编译真的失败了,可能是RAM太少。我通常只是提交我的Dockerfiles并让hub.docker.com构建它们,但我也经常在本地测试新的或变体,它们构建得很好。如果你在一个功能不足的云实例上:Rcpp是C++,确实需要编译器提供一点RAM。所以不要尝试最便宜的1核512 mb RAM选项。

但你也有其他选择。由于这是一个带有apt的系统,只需安装更多的CRAN包作为预先制作的二进制文件:apt-get install r-cran-rcpp r-cran-data.table等等

最新更新