2

我已经在 Deepnote 中设置了一个带有 R 内核的自定义环境,我想使用 Dockerfile 来安装马赛克包(否则我必须每天手动安装它,这需要一段时间)。当我添加

RUN R -e 'install.packages("mosaic")'

IRkernel::installspec在 Dockerfile 中的行之后,我得到以下输出:

Step #1: > install.packages("mosaic")
Step #1: Installing package into ‘/usr/local/lib/R/site-library’
Step #1: (as ‘lib’ is unspecified)
Step #1: Warning in install.packages("mosaic") :
Step #1:   'lib = "/usr/local/lib/R/site-library"' is not writable
Step #1: Error in install.packages("mosaic") : unable to install packages
Step #1: Execution halted
Step #1: The command '/bin/sh -c R -e 'install.packages("mosaic")'' returned a non-zero code: 1
Finished Step #1
ERROR
ERROR: build step 1 "gcr.io/cloud-builders/docker" failed: step exited with non-zero status: 1
Step #1: 

我究竟做错了什么?

4

1 回答 1

3

您链接到的示例具有sudo

RUN sudo apt-get update && \
    sudo apt-get install -y r-base

RUN sudo R -e "install.packages('IRkernel', repos='http://cran.rstudio.com/')"
    ^^^^

is not writable收到消息后,您可能也需要它。

于 2020-09-23T09:48:23.310 回答