我对 Docker 概念比较陌生,我正在尝试对我构建的 Shinys 应用程序之一进行 docker 化。
因为我正在处理 Google 分析数据 其中一个依赖项来自 github 存储库,我在其中使用名为 rga
的包。存储库的链接是 https://github.com/skardhamar/rga
下面是我按照这篇文章创建的 Docker 文件 https://www.bjoern-hartmann.de/post/learn-how-to-dockerize-a-shinyapp-in-7-steps/
# Install R version 3.5
FROM r-base:3.5.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
# TODO: add further package if you need!
RUN R -e "install.packages(c('shiny', 'shinydashboard', 'dplyr', 'ggplot2', 'bigrquery', 'devtools'), repos='http://cran.rstudio.com/')"
RUN R -e "devtools::install_github('rga', 'skardhamar')"
# 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"]
但是,在尝试构建 docker 镜像时会抛出如下错误
Error in parse_repo_spec(repo) : Invalid git repo specification: 'rga'
Calls: <Anonymous> -> lapply -> FUN -> parse_git_repo -> parse_repo_spec
Execution halted
当变为
RUN R -e "devtools::install_github("rga", "skardhamar")"
出现以下错误:
Error in lapply(repo, github_remote, ref = ref, subdir = subdir, auth_token = auth_token, :
object 'rga' not found
Calls: <Anonymous> -> lapply
Execution halted
最佳答案
我设法通过使用
解决了这个问题RUN R -e "devtools::install_github('skardhamar/rga')"
关于docker - parse_repo_spec(repo) 错误 : Invalid git repo specification: 'rga' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56014951/