I would like to run plumber API on Docker container.
I tried the following two dockerfiles:
The first Dockerfile
FROM rstudio/plumber
MAINTAINER Docker User <docker@user.org>
RUN R -e "install.packages('broom')"
RUN mkdir -p ~/application
# copy everything from the current directory into the container
COPY "/" "application/"
WORKDIR "application/"
# open port 80 to traffic
EXPOSE 80
# when the container starts, start the main.R script
ENTRYPOINT ["Rscript", "execute_plumber.R"]
The second Dockerfile:
FROM rocker/r-ver:4.0.2
# install the linux libraries needed for plumber
RUN apt-get update -qq && apt-get install -y \
libssl-dev \
libcurl4-gnutls-dev
# install plumber
RUN R -e "install.packages('plumber')"
RUN mkdir -p ~/application
# copy everything from the current directory into the container
COPY "/" "application/"
WORKDIR "application/"
# open port 80 to traffic
EXPOSE 80
# when the container starts, start the main.R script
ENTRYPOINT ["Rscript", "execute_plumber.R"]
Both of them resulted in the following error:
* Downloading renv 0.12.0 from CRAN archive ... OK
* Installing renv 0.12.0 ... Done!
Successfully installed and loaded renv 0.12.0.
Error in library(plumber) : there is no package called ‘plumber’
Execution halted
In case of the second Dockerfile I also tried to install different linux libraries such
git-core
libcurl4-openssl-dev
xml2 openssl
None of them helped.
I am running it on Azure. Any suggestions?
UPDATE
In container build log file I can clearly see the plumber
was successfully installed.
> install.packages('plumber')
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
also installing the dependencies ‘curl’, ‘Rcpp’, ‘later’, ‘BH’, ‘rlang’, ‘glue’, ‘R6’, ‘stringi’, ‘jsonlite’, ‘webutils’, ‘httpuv’, ‘crayon’, ‘promises’, ‘sodium’, ‘swagger’, ‘magrittr’, ‘mime’, ‘lifecycle’
...
* DONE (plumber)