I'm trying to install plumber and RPostgreSQL into my docker image. Here's my dockerFile:
FROM rocker/r-base
RUN R -e "install.packages('plumber')"
RUN R -e "install.packages('RPostgreSQL')"
RUN mkdir -p /code
COPY ./plumber.R /code/plumber.R
CMD Rscript --no-save /code/plumber.R
The only thing my plumber script does is try to reference the RPostgreSQL package:
library('RPostgreSQL')
When I build, it appears to successfully install both packages, but when my script runs, it complains that RPostgreSQL doesn't exist. I've tried other base images, I've tried many things.
Any help appreciated. Thanks!
You are trying to install
RPostgres
and then trying to loadRPostgreSQL
-- these are different packages. Hence the error.Next, as you are on
r-base
, the latter is installed more easily assudo apt install r-cran-rpostgresql
(maybe after an intialsudo apt update
). While you're at it, you can also installplumber
as a pre-made binary (along with its dependencies). Sois easier and faster.