title: How to build Dockerfile with R & Java
body: <p>I'm trying to build a Docker container that runs R with the package RJava. I have tried the following code:</p>
  
  <pre><code># Install R version 3.6.3
  FROM rocker/tidyverse:3.6.3
  
  # Make ~/.R
  RUN mkdir -p $HOME/.R
  
  # Install Ubuntu packages &amp;&amp; then R packages
  RUN install2.r --error \
           lubridate magrittr RPostgres DBI broom rlang rJava
  </code></pre>
  
  <p>However I get the following: installation of package ‘rJava’ had non-zero exit status.</p>
  
  <p>Can anyone help me with this. I'm thinking that maybe it is because Java is not installed. Does anyone know how to install Java on this docker container?</p>
  
  <p>I've tried adding the following to my dockerfile as per another post I found however I get the error saying 'The repository '<a href="http://ppa.launchpad.net/webupd8team/java/ubuntu" rel="nofollow noreferrer">http://ppa.launchpad.net/webupd8team/java/ubuntu</a> focal Release' does not have a Release file:</p>
  
  <pre><code># Install "software-properties-common" (for the "add-apt-repository")
  RUN apt-get update &amp;&amp; apt-get install -y \
      software-properties-common
  
  # Add the "JAVA" ppa
  RUN add-apt-repository -y \
      ppa:webupd8team/java
  
  # Install OpenJDK-8
  RUN apt-get update &amp;&amp; \
      apt-get install -y openjdk-8-jdk &amp;&amp; \
      apt-get install -y ant &amp;&amp; \
      apt-get clean;
  
  # Fix certificate issues
  RUN apt-get update &amp;&amp; \
      apt-get install ca-certificates-java &amp;&amp; \
      apt-get clean &amp;&amp; \
      update-ca-certificates -f;
  
  # Setup JAVA_HOME -- useful for docker commandline
  ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/
  RUN export JAVA_HOME
  </code></pre>
  
  <p>I'm new to docker and any help with this would be much appreciated.</p>