我试图通过Jenkins管道建立一个docker镜像,这需要很长的时间(4-5个小时,大多数时候都失败了)。当我从同一台Jenkins机器的命令行构建镜像时,大约需要20分钟。以下是作业停滞的Dockerfile命令-
ARG PKGS="askpass, assertthat, backports, base64enc, BH, bit, bit64, blob, brew, brio, broom, callr, caret, cellranger, chron, cli, clipr, colorspace, commonmark, config, covr, cpp11, crayon, credentials, crosstalk, curl, data.table, DBI, dbplyr, desc, devtools, diffobj, digest, dplyr, DT, ellipsis, evaluate, fansi, farver, fastmap, forcats, foreach, forge, fs, future, generics, gert, ggplot2, gh, gitcreds, glmnet, globals, glue, gower, gridExtra, gsubfn, gtable, haven, highr, hms, htmlwidgets, httpuv, httr, ini, ipred, isoband, iterators, jsonlite, knitr, labeling, later, lava, lazyeval, lifecycle, listenv, lubridate, magrittr, markdown, memoise, mime, ModelMetrics, modelr, munsell, numDeriv, openssl, parallelly, pillar, pkgbuild, pkgconfig, pkgload, plogr, plyr, praise, prettyunits, pROC, processx, prodlim, progress, promises, proto, ps, purrr, r2d3, R6, randomForest, rappdirs, rcmdcheck, RColorBrewer, Rcpp, readxl"
# Install through pak and other cleanup tasks
RUN Rscript -e 'install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")' \
&& echo "$PKGS" \
| Rscript -e 'pak::pkg_install(strsplit(readLines("stdin"), ", ?")[[1L]], ask = FALSE)' \
&& Rscript -e 'pak::cache_clean()'
ARG PKGS="recipes, rematch, rematch2, remotes, reprex, reshape2, rex, rlang, rmarkdown, roxygen2, rprojroot, RSQLite, rstudioapi, rversions, rvest, scales, selectr, sessioninfo, shape, shiny, sourcetools, sparklyr, SparkR, sqldf, SQUAREM, stringi, stringr, sys, testthat, tibble, tidyr, tidyselect, tidyverse, timeDate, tinytex, usethis, utf8, uuid, vctrs, viridisLite, waldo, whisker, withr, xfun, xml2, xopen, xtable, yaml, zip"
# Install through pak and other cleanup tasks
RUN Rscript -e 'install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")' \
&& echo "$PKGS" \
| Rscript -e 'pak::pkg_install(strsplit(readLines("stdin"), ", ?")[[1L]], ask = FALSE)' \
&& Rscript -e 'pak::cache_clean()'我怀疑这与Jenkins有关,因为从命令行构建可以很好地完成。Jenkins中是否有一些设置减慢了这些包的下载和安装速度?谢谢。
发布于 2021-06-18 21:32:13
解决了这个问题,需要用前缀\对$字符进行转义,这样它就不会被求值。基本上用"\\$PKGS"替换"$PKGS"。
https://stackoverflow.com/questions/68000565
复制相似问题