簡體   English   中英

如何使R的install.packages在Dockerfile中出錯?

[英]How to get R's install.packages to error out in a Dockerfile?

下面是一個失敗的命令,但是Docker繼續前進。 我很確定這是因為'警告'(“安裝中包含非零退出代碼”)沒有作為非零退出代碼向外傳遞到Rscript調用。

我如何才能停止Docker構建?

Step 21/44 : RUN Rscript -e 'install.packages("https://cran.rstudio.com/src/contrib/prophet_0.1.tar.gz", dependencies=TRUE)'
 ---> Running in 26ba0c1da37c
Installing package into ‘/usr/local/spark-1.6.1-bin-hadoop2.6/R/lib’
(as ‘lib’ is unspecified)
inferring 'repos = NULL' from 'pkgs'
trying URL 'https://cran.rstudio.com/src/contrib/prophet_0.1.tar.gz'
Content type 'application/x-gzip' length 75619 bytes (73 KB)
==================================================
downloaded 73 KB

ERROR: dependencies ‘extraDistr’, ‘rstan’ are not available for package ‘prophet’
* removing ‘/usr/local/spark-1.6.1-bin-hadoop2.6/R/lib/prophet’
Warning message:
In install.packages("https://cran.rstudio.com/src/contrib/prophet_0.1.tar.gz",  :
  installation of package ‘/tmp/RtmpAa2XQV/downloaded_packages/prophet_0.1.tar.gz’ had non-zero exit status

您可以通過設置options(warn = 2)強制將警告視為錯誤(即立即“停止” options(warn = 2) ?options

 'warn': sets the handling of warning messages.  If 'warn' is
      negative all warnings are ignored.  If 'warn' is zero (the
      default) warnings are stored until the top-level function
      returns.  If 10 or fewer warnings were signalled they will be
      printed otherwise a message saying how many were signalled.
      An object called 'last.warning' is created and can be printed
      through the function 'warnings'.  If 'warn' is one, warnings
      are printed as they occur.  If 'warn' is two or larger all
      warnings are turned into errors.

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM