简体   繁体   中英

R there is no package called in a docker container

I have a docker image where I install several packages using the following lines:

FROM rocker/verse:4.0.3
... (some other installation details)
RUN install2.r --error \
    glmnet \
    ineq
    ...

However, I sporadically get error messages when running a container from that image where it seems like R cannot find that package:

Error in library(ineq) : there is no package called 'ineq'

If I create a new version of the container and manually open R and run it, I can never reproduce this error. Does anyone have any idea of how I can fix this (or what I should be looking for to reproduce this)?

Hitting the same "weird" behaviour..

My workaround was (I know its not elegant) using pacman instead of the library lines. What pacman does if it can't find the library it simply installs it. Which is obviously rude and anti-container pattern but at some point we need to move on:-/.. A big disadvantage here is that the container startup time could be huge if it is lost all of its packages and starts to re-install them

if(!require("pacman")) install.packages("pacman")
pacman::p_load("glmnet","ineq")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM