r - 无法在 r shiny docker 中安装 devtools
问题描述
我正在尝试为我闪亮的应用程序构建一个 docker 映像。下面是我的dockerfile
。当我构建图像时,其他一切似乎都很好,除了我收到错误消息Error in library(devtools) : there is no package called ‘devtools’ Execution halted
。我也试过devtools::install_github('nik01010/dashboardthemes')
没有成功。我不知道为什么?会出什么问题?有人知道我的 dockerfile 有什么问题吗?非常感谢。
# Install R version 3.6
FROM r-base:3.6.0
# Install Ubuntu packages
RUN apt-get update && apt-get install -y \
sudo \
gdebi-core \
pandoc \
pandoc-citeproc \
libcurl4-gnutls-dev \
libcairo2-dev/unstable \
libxt-dev \
libssl-dev
# Download and install ShinyServer (latest version)
RUN wget --no-verbose https://s3.amazonaws.com/rstudio-shiny-server-os-build/ubuntu-12.04/x86_64/VERSION -O "version.txt" && \
VERSION=$(cat version.txt) && \
wget --no-verbose "https://s3.amazonaws.com/rstudio-shiny-server-os-build/ubuntu-12.04/x86_64/shiny-server-$VERSION-amd64.deb" -O ss-latest.deb && \
gdebi -n ss-latest.deb && \
rm -f version.txt ss-latest.deb
# Install R packages that are required
RUN R -e "install.packages(c('devtools', 'shiny','shinythemes','shinydashboard','shinyWidgets','shinyjs', 'tidyverse', 'dplyr', 'ggplot2','rlang','DT','lubridate', 'plotly', 'leaflet', 'mapview', 'tigris', 'rgdal', 'visNetwork', 'wordcloud2', 'arules'), repos='http://cran.rstudio.com/')"
RUN R -e "library(devtools)"
RUN R -e "install_github('nik01010/dashboardthemes')"
# Copy configuration files into the Docker image
COPY shiny-server.conf /etc/shiny-server/shiny-server.conf
COPY /app /srv/shiny-server/
# Make the ShinyApp available at port 80
EXPOSE 80
# Copy further configuration files into the Docker image
COPY shiny-server.sh /usr/bin/shiny-server.sh
CMD ["/usr/bin/shiny-server.sh"]
解决方案
您可以尝试几种方法。
最简单的:
使用remotes::install_github
而不是devtools
. remotes
如果您不需要其他功能,则依赖项会少得多。
第二简单:
使用来自 Docker Hub 的rocker/tidyverse映像而不是 baseR 映像。
docker pull rocker/tidyverse
更改第 2 行:
FROM rocker/verse
最难的:
否则,在安装devtools
. 如果您尝试以交互方式安装它,这可能会很明显。
- 确保容器正在运行
- 使用获取容器名称
docker ps
- 启动一个shell
docker exec -it <container name> /bin/bash
- 开始
R
并尝试以devtools
交互方式安装
推荐阅读
- sql-server - SQL Server 2019 的 TempDB 缓存问题
- angular9 - 默认情况下,Angular 8 Material mat-error 在加载时显示
- python - 基于 n 个骰子的随机游走步骤
- java - 循环 x 个单词并移动 1 个位置
- reactjs - 图表中值为 0 时不应显示散点图
- flutter - 使用 Shared Preferences 包实现数据持久性
- apache-nifi - NGINX 代理背后的 NiFi 远程进程组 未经授权/匿名
- kubernetes-helm - helm - 如何迭代具有复杂值的地图
- php - .htaccess RewriteMod 在 XAMPP 中无法正常工作
- python - openpyxl 版本 2.6.4 的问题 - 'MergedCell' 对象属性 'value' 是只读的