Dockerfile Oracle

Does anyone have a current Dockerfile that works with Oracle they could share?

We are continually struggling to get a Rmd file to run correctly. We keep getting various java.lang errors which I’m guessing have to do with the Oracle connection which is using RJDBC and rJava. During the build process I’m not getting an errors related to them.

In my Dockerfile I used curl to install the ODBC for my Linux distro when connecting to a MS SQL database. You could probably do something similar and install the JDBC driver from Microsoft using curl.

Thanks, that’s something I’ll look at.

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’))”]

1 Like

Disregard. still not working with oracle connection.