Dockerfile that worked for connecting to Oracle, CMD javareconf is very important.
Dockerfile:
FROM openanalytics/r-base
ORIGINAL_MAINTAINER Tim M.Schendzielorz “tim.schendzielorz@googlemail.com”
MAINTAINER John Reber “John.Reber@jefferson.edu”
Install Java for rJava
RUN apt-get update &&
apt-get install -y default-jdk &&
apt-get install -y default-jre &&
rm -rf /var/lib/apt/lists/*
RUN [“java”, “-version”]
RUN apt-get update && apt-get install -y
libcurl4-openssl-dev
libssl-dev
libxml2-dev &&
rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y
sudo
pandoc
pandoc-citeproc
libcairo2-dev
libxt-dev
libssh2-1-dev &&
rm -rf /var/lib/apt/lists/*
WORKDIR /opt/oracle
RUN apt-get update && apt-get install -y libaio1 wget unzip
&& wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-basiclite-linuxx64.zip
&& unzip instantclient-basiclite-linuxx64.zip
&& rm -f instantclient-basiclite-linuxx64.zip
&& cd /opt/oracle/instantclient*
&& rm -f jdbc occi mysql *README jar uidrvci genezi adrci
&& echo /opt/oracle/instantclient > /etc/ld.so.conf.d/oracle-instantclient.conf
&& ldconfig
WORKDIR /
RUN apt-get update && apt-get install -y
libmysql+±dev
unixodbc-dev
libpq-dev &&
rm -rf /var/lib/apt/lists/*
VERY IMPORTANT to set java environment for R
CMD javareconf
install needed R packages
RUN R -e “install.packages(c(‘shiny’), dependencies = TRUE, repo=‘https://cloud.r-project.org’)”
RUN R -e “install.packages(c(‘flexdashboard’, ‘dplyr’, ‘rJava’, ‘RJDBC’, ‘readr’, ‘DT’, ‘lubridate’, ‘rmarkdown’), dependencies = TRUE, repo=‘https://cloud.r-project.org’)”
make directory and copy Rmarkdown flexdashboard file in it
RUN mkdir -p /prmc
COPY prmc/PRMC.Rmd /prmc/PRMC.Rmd
COPY prmc/prmc.sql /prmc/prmc.sql
COPY prmc/ojdbc11.jar /prmc/ojdbc11.jar
Copy Rprofile.site to the image
COPY Rprofile.site /usr/local/lib/R/etc/
make all app files readable (solves issue when dev in Windows, but building in Ubuntu)
RUN chmod -R 755 /prmc
expose port on Docker container
EXPOSE 3838
run flexdashboard as localhost and on exposed port in Docker container
CMD [“R”, “-e”, “rmarkdown::run(’/prmc/PRMC.Rmd’, shiny_args = list(port = 3838, host = ‘0.0.0.0’))”]