【问题标题】:How to install in a docker container an old version of a r package如何在 docker 容器中安装旧版本的 r 包
【发布时间】:2020-05-26 07:22:56
【问题描述】:

如何在 docker 容器中安装 ggplot2 2.2.1?

命令行

RUN R -e "install.packages('devtools', repos='http://cran.rstudio.com/')"
RUN R -e "devtools::install_github('http://github.com/tidyverse/ggplot2/archive/v2.2.1.tar.gz')"

在 Dockerfile 中给了我错误:

The command '/bin/sh -c R -r "devtools::install_github('https://github.com/tidyverse/ggplot2/archive/v2.2.1.tar.gz')"' returned a non-zero code: 2

如果我删除该行

RUN R -e "devtools::install_github('http://github.com/tidyverse/ggplot2

没有出现错误。我还尝试了不同的方法来安装 ggplot2 2.2.1,但都导致了相同的结果/错误。

【问题讨论】:

  • 您是否尝试过使用 docker build -f 显式定义 Dockerfile 位置?这是一个经常被忽视的细节,它会返回您收到的错误。
  • 不起作用...同样的错误。没有 RUN R -e "devtools::install_github('github.com/tidyverse/ggplot2/archive/v2.2.1.tar.gz')" 我可以构建图像
  • 现在我得出的结论是没有正确安装devtools。显然,在 linux 下需要额外的包,我仍然需要找出来。这些在开头安装:gdebi-core\pandoc\pandoc-citeproc\libcurl4-gnutls-dev\libcairo2-dev\libxt-dev\libssl-dev\libxml2-dev

标签: r docker package version


【解决方案1】:

我通过更改命令解决了问题

RUN R -e "install.packages('devtools', repos='http://cran.rstudio.com/', dependencies = TRUE)"

现在 devtools 已正确安装。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-06-09
    • 2021-09-11
    • 2018-12-17
    • 1970-01-01
    • 2016-01-14
    • 2016-10-12
    • 1970-01-01
    相关资源
    最近更新 更多