我对闪亮的应用程序的dockerization问题。我有一个用R 3.4.4开发的闪亮小应用程序。我想将其泊坞窗。我已经这样写了我的dockerfile:
FROM r-base:3.4.4
MAINTAINER aurelien beliard (email@domain.com)
RUN apt update
RUN apt install -y libcairo2-dev\
liblapack-dev \
liblapack3 \
libopenblas-base \
libopenblas-dev \
libxml2-dev \
libssl1.0.2 \
libssl-dev \
libcurl4-openssl-dev \
libudunits2-dev
RUN R -e "install.packages('shiny',dependencies=TRUE, repos='cran.rstudio.com/')";
RUN apt install -y gdebi-core
RUN wget https://download3.rstudio.org/ubuntu-14.04/x86_64/shiny-server-1.5.7.907-amd64.deb
RUN gdebi -n shiny-server-1.5.7.907-amd64.deb
RUN apt update
RUN R -e "install.packages('ggplot2',dependencies=TRUE, repos='cran.rstudio.com/')";
RUN R -e "install.packages('shinydashboard',dependencies=TRUE, repos='cran.rstudio.com/')";
RUN R -e "source('https://bioconductor.org/biocLite.R');\
biocLite('Gviz')";
COPY ./sources/ /srv/shiny-server/wes-cnv
COPY ./data /srv/shiny-server/wes-cnv/data
EXPOSE 3838
CMD ["/usr/bin/shiny-server"]
我使用docker build并且R软件包似乎是随R3.5.1一起安装的,当我以交互方式运行容器并在bash shell中执行R时,R版本是3.5.1:
R version 3.5.1 (2018-07-02) -- "Feather Spray"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
当我打电话给ggplot2时:
library('ggplot2')
我遇到此错误:
Error in library("ggplot2") : there is no package called ‘ggplot2’
ggplot2似乎在安装过程中出错,因为它说库是在另一个R版本中安装的:
Error : package ‘stringi’ was installed by an R version with different internals; it needs to be reinstalled for use with this R version
但是闪亮的服务器可以正常工作。
如果有人有解释或/和解决方案,将不胜感激
ps:请在这里回答我的第一个问题,英语不是我的母语。
答案 0 :(得分:1)
FROM r-base:3.4.4
正确安装了R版本3.4.4,但是您的apt install -y libcurl4-openssl-dev
然后将其更新为最新版本(即3.5.1)。
您可以进行交互测试。从非常简单的单行Dockerfile
开始:
FROM r-base:3.4.4
将其构建为docker build -t tester .
,并以docker run -it --entrypoint /bin/bash tester
交互式运行:
root@0f5bb0fb300e:/# R --version | grep "R version"
R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
到目前为止一切顺利!让我们运行Dockerfile的下两行:
root@0f5bb0fb300e:/# apt update
Get:1 http://cdn-fastly.deb.debian.org/debian testing InRelease [150 kB]
...
root@0f5bb0fb300e:/# apt install libcurl4-openssl-dev
...
The following packages will be upgraded:
r-base-core r-cran-boot r-cran-class r-cran-codetools r-cran-kernsmooth r-cran-lattice r-cran-mass r-cran-mgcv r-cran-nnet r-cran-rpart r-cran-spatial
...
因为您的Dockerfile使用-y
标志运行了最后一个命令,所以docker build
自动同意将R升级到最新版本。