[英]Trouble installing local R library on docker
我正在嘗試在 docker 上部署我的 Shiny 應用程序(使用 rocker/shiny-verse:3.6.3 基本映像),但是當我嘗試通過 Z05B6053C41A213EAFZ6 安裝本地(非 CRAN)軟件包時遇到問題。 在 RStudio 內完成安裝工作正常。
Docker 引擎 v19.03.13
操作系統:Windows 10 企業版
> install.packages("<FULLPATH>/customLibrary.zip", repos = NULL, type = "win.binary")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/p/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
package ‘customLibrary’ successfully unpacked and MD5 sums checked
FROM rocker/shiny-verse:3.6.3
RUN R -e "install.packages('<FULLPATH>/customLibrary.zip', repos = NULL, type = 'win.binary')"
RUN R -e "install.packages(c('gtable', 'data.table', 'shinydashboard', 'ggplot2'), repos='https://cran.rstudio.com', dependencies=FALSE)"
COPY . /srv/shiny-server
EXPOSE 3838
[+] Building 0.8s (6/8)
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 465B 0.0s
=> [internal] load .dockerignore 0.1s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/rocker/shiny-verse:3.6.3 0.0s
=> CACHED [1/4] FROM docker.io/rocker/shiny-verse:3.6.3 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 517B 0.0s
=> ERROR [2/4] RUN R -e "install.packages('<FULLPATH>/customRLibrary.zip', repos = NULL, type = 'win.bin 0.7s
------
> [2/4] RUN R -e "install.packages('<FULLPATH>/customRLibrary.zip', repos = NULL, type = 'win.binary')":
#5 0.599
#5 0.599 R version 3.6.3 (2020-02-29) -- "Holding the Windsock"
#5 0.599 Copyright (C) 2020 The R Foundation for Statistical Computing
#5 0.599 Platform: x86_64-pc-linux-gnu (64-bit)
#5 0.599
#5 0.599 R is free software and comes with ABSOLUTELY NO WARRANTY.
#5 0.599 You are welcome to redistribute it under certain conditions.
#5 0.599 Type 'license()' or 'licence()' for distribution details.
#5 0.599
#5 0.599 R is a collaborative project with many contributors.
#5 0.599 Type 'contributors()' for more information and
#5 0.599 'citation()' on how to cite R or R packages in publications.
#5 0.599
#5 0.599 Type 'demo()' for some demos, 'help()' for on-line help, or
#5 0.599 'help.start()' for an HTML browser interface to help.
#5 0.599 Type 'q()' to quit R.
#5 0.599
#5 0.723 > install.packages('<FULLPATH>/customRLibrary.zip', repos = NULL, type = 'win.binary')
#5 0.728 Installing package into ‘/usr/local/lib/R/site-library’
#5 0.728 (as ‘lib’ is unspecified)
#5 0.728 Error in install.packages("<FULLPATH>/customRLibrary.zip", :
#5 0.728 cannot install Windows binary packages on this platform
#5 0.728 Execution halted
------
failed to solve with frontend dockerfile.v0: failed to build LLB: executor failed running [/bin/sh -c R -e "install.packages('<FULLPATH>/customRLibrary.zip', repos = NULL, type = 'win.binary')"]: runc did not terminate sucessfully
有人能指出我哪里出錯了嗎? TIA。
在 RStudio 中,您開發 package,安裝 devtools 然后運行
devtools::build(binary = FALSE)
它將生成可以安裝在任何平台上的 tar.gz package。
rocker-org/shiny
的 dockerfile 建立在 Debian 之上。
這是 Shiny 服務器上的 Dockerfile 穩定版。
請參閱GitHub和DockerHub -這里是 dockerfile。
這意味着對您的 OP 的評論是正確的。 您正在嘗試在 linux 上安裝 windows 二進制文件,但這不起作用。 因此,您的問題就在這里。
install.packages("<FULLPATH>/customLibrary.zip", repos = NULL, type = "win.binary")
我想解決方案是為 linux 編譯您的customLibrary
並簡單地做
install.packages("<FULLPATH>/customLibrary.zip", repos = NULL)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.