1

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!

1 Answer 1

2

You are trying to install RPostgres and then trying to load RPostgreSQL -- these are different packages. Hence the error.

Next, as you are on r-base, the latter is installed more easily as sudo apt install r-cran-rpostgresql (maybe after an intial sudo apt update). While you're at it, you can also install plumber as a pre-made binary (along with its dependencies). So

RUN apt update -qq \
     && apt install --yes --no-install-recommends \
            r-cran-rpostgresql \
            r-cran-plumber

is easier and faster.

Sign up to request clarification or add additional context in comments.

3 Comments

Sorry for typo above, i was in fact trying to install RPostgreSQL package, so that was not the problem. However, your apt command does the trick. Thanks!
correct flag is: '--no-install-recommends', with 2 hyphens
Now the typo is mine :) Will fix.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.