使用Docker部署应用程序
我正在尝试使用Docker部署R Shining应用程序。但我不断收到以下错误,即应用程序所需的软件包未安装在docker上,即使我使用Dockerfile脚本安装了它们使用Docker部署应用程序,r,docker,shiny,R,Docker,Shiny,我正在尝试使用Docker部署R Shining应用程序。但我不断收到以下错误,即应用程序所需的软件包未安装在docker上,即使我使用Dockerfile脚本安装了它们 '/var/log/shiny-server//shiny-server-shiny-20210531-160002-46437.log' has been created ***/var/log/shiny-server//shiny-server-shiny-20210531-160002-46437.log *** s
'/var/log/shiny-server//shiny-server-shiny-20210531-160002-46437.log' has been created
***/var/log/shiny-server//shiny-server-shiny-20210531-160002-46437.log ***
su: ignoring --preserve-environment, its mutually exclusive with --login
Error in library(shinydashboard) :
there is no package called ‘shinydashboard’
Calls: runApp ... sourceUTF8 -> eval -> eval -> ..stacktraceon.. -> library
Execution halted
我的Dockerfile看起来像这样
FROM rocker/r-ver:3.6.3
RUN apt-get update && apt-get install -y \
sudo \
gdebi-core \
pandoc \
pandoc-citeproc \
libcurl4-gnutls-dev \
libcairo2-dev \
libxt-dev \
xtail \
wget
#RUN sudo su - -c "R -e \"install.packages(c('plyr'), repos='http://cran.rstudio.com/')\""
# Download and install shiny server
RUN wget --no-verbose https://download3.rstudio.org/ubuntu-14.04/x86_64/VERSION -O
"version.txt" && \
VERSION=$(cat version.txt) && \
wget --no-verbose "https://download3.rstudio.org/ubuntu-14.04/x86_64/shiny-
server-$VERSION-amd64.deb" -O ss-latest.deb && \
gdebi -n ss-latest.deb && \
rm -f version.txt ss-latest.deb && \
. /etc/environment && \
R -e "install.packages(c('shiny',
'plotly','shinydashboard','dplyr','ggplot2','DT','shinyjs','sodium','shinyWidgets','magrittr','tidyr','shinythemes'), repos='$MRAN')" && \
cp -R /usr/local/lib/R/site-library/shiny/examples/* /srv/shiny-server/ && \
chown shiny:shiny /var/lib/shiny-server
EXPOSE 3838
COPY shiny-server.sh /usr/bin/shiny-server.sh
CMD ["/usr/bin/shiny-server.sh"]
我的shinny-server.sh文件如下所示:
#!/bin/sh
# Make sure the directory for individual app logs exists
mkdir -p /var/log/shiny-server
chown shiny.shiny /var/log/shiny-server
if [ "$APPLICATION_LOGS_TO_STDOUT" != "false" ];
then
# push the "real" application logs to stdout with xtail in detached mode
exec xtail /var/log/shiny-server/ &
fi
# start shiny server
exec shiny-server 2>&1
在我的系统上,
install.packages('shinydashboard',repos='$MRAN')
不起作用,但install.packages('shinydashboard')
起作用