Lauren, little oversight from my Dockerfile, if you want to follow the CRAN 
steps and get the R from the cloud.r-project.org server, you want to replace
     && add-apt-repository -y "ppa:marutter/rrutter4.0"

With
    && add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu 
$(lsb_release -cs)-cran40/"

The ppa repo is Michael Rutter personal repo on launchpad.net, which works just 
fine but is not the CRAN sanctioned way of getting the R package.

Now, both AMD64 and ARM64 (Intel and Mac chip) binaries for Ubuntu are 
available on cloud.r-project.org which will allow you to compile your Ubuntu 
based docker image on either Intel or Mac chipset machines (few months ago only 
the Intel built was available on cloud.r-project.org which necessitated us to 
use M. Rutter PPA).

Here’s our current r-base Dockerfile which, as I said, also install a couple 
commonly used libs in R packages and the step to install Bio Conductor base 
package (if you don’t use BioC, delete it):

FROM ubuntu:22.04

USER root

ENV DEBIAN_FRONTEND noninteractive

# Configure Ubuntu for R install
RUN apt-get update \
    && apt-get install -y --no-install-recommends \
    software-properties-common \
    gnupg2 \
    wget \
    build-essential \
    libcurl4-openssl-dev \
    libxml2-dev \
    && wget -q -O - 
https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc \
    | tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc  \
    && add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu 
$(lsb_release -cs)-cran40/"

RUN apt-get update -y \
    && apt-get install -y r-base\
    && apt-get clean \
    && apt-get purge \
    && rm -rf /var/lib/apt/lists/* /tmp/*

## Configure parallel options to use max CPUs by default and install BioC
RUN /usr/bin/R -e 'options(Ncpus = parallel::detectCores())'\
    -e 'install.packages("BiocManager")' \
    -e 'BiocManager::install()'

Marco

From: Gerber, Lauren J <lauren.ger...@helsinki.fi>
Date: Wednesday, July 10, 2024 at 9:43 AM
To: Dirk Eddelbuettel <e...@debian.org>
Cc: Dirk Eddelbuettel <e...@debian.org>, marcoblanche...@icloud.com 
<marcoblanche...@icloud.com>, r-sig-debian@r-project.org 
<r-sig-debian@r-project.org>
Subject: Re: [R-sig-Debian] Issues with Ubuntu 22.04 and Installing the Latest 
Version of R (R 4.4.1) to Docker Image
Hi Dirk,

Thank you so much for looking into this when you got home. I greatly appreciate 
it.

I was actually in the midst of writing to everyone the following message:
….
….
….

Hi All,

I have some good news. 😊 My docker image is now up-to-date with R version 4.4.1.

I first had to clear a bunch of unused data using docker system prune –force. 
Apparently, it cleared over 32.53 gigs of data, and seemed to have been 
interfering with some of the package installations trying to take place.

Next, I tried using part of Marco’s dockerfile and it helped solve the issue:

RUN apt-get update \
      && apt install -y \
      software-properties-common \
      dirmngr \
      gnupg2 \
      wget \
      build-essential \
      libcurl4-openssl-dev \
      libxml2-dev \
      libasound2 \
      python3 \
      python3-pip \
      python3.10-venv \
      git-all \
      lsb-release \
      libxml-twig-perl \
      libc6-dev \
      && wget -q -O - 
https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc \
      | tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc  \
&& add-apt-repository -y "ppa:marutter/rrutter4.0"

 RUN apt-get update -y \
     && apt-get install -y r-base\
     && apt-get clean \
     && apt-get purge \
     && rm -rf /var/lib/apt/lists/* /tmp/*

Then I ran my Docker image in interactive mode to check it and it worked 😊:
/# apt-cache policy r-base-core
r-base-core:
  Installed: 4.4.1-1.2204.0
  Candidate: 4.4.1-1.2204.0
  Version table:
 *** 4.4.1-1.2204.0 100
        100 /var/lib/dpkg/status

This is great. Thank you all so much.

Br,
Lauren
--
Lauren J. Gerber
Bioinformatician
Precision Systems Medicine (Kallioniemi) Research Group
iCAN – Digital Precision Cancer Medicine Flagship
Institute for Molecular Medicine Finland (FIMM)
Nordic EMBL Partnership for Molecular Medicine
Biomedicum Helsinki 2U, D301a1
P.O. Box 20 (Tukholmankatu 8)
FI-00014 University of Helsinki, Finland
lauren.ger...@helsinki.fi

From: Dirk Eddelbuettel <e...@debian.org>
Date: Wednesday, 10. July 2024 at 19.09
To: Gerber, Lauren J <lauren.ger...@helsinki.fi>
Cc: Dirk Eddelbuettel <e...@debian.org>, marcoblanche...@icloud.com 
<marcoblanche...@icloud.com>, r-sig-debian@r-project.org 
<r-sig-debian@r-project.org>
Subject: Re: [R-sig-Debian] Issues with Ubuntu 22.04 and Installing the Latest 
Version of R (R 4.4.1) to Docker Image

Lauren,

I am now back home where looking into these things is a little easier. From
your first email to me, I started off with the selenium container you
mentioned as your starting point.

And that basically is your issue. It is a 'high-level' container, and it sets
a user. (Essentially) all other Dockerfiles you have seen and been pointed at
are 'lower-level' and operate as root -- so you need to inject 'sudo' calls.
Otherwise it really is 'just' getting one key and adding one repo, but it
helps to have had the same user <-> root issues before ...

So below is a working 'minimal' Dockerfile that gets me R 4.4.1 (validated
via 'docker exec -ti container_id_here bash' once built). Hope it helps.

Best,  Dirk



FROM selenium/standalone-firefox:latest

## Following the standard rocker/r2u:jammy Dockerfile, and adapted slightly

RUN sudo apt update \
##
## We would normally do
##   apt install --yes --no-install-recommends ca-certificates locales wget
## but these are already installed
##
## So we skip to the next step of adding the key and repo
   && wget -q -O - 
https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc \
           | sudo tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc  \
   && echo "deb [arch=amd64 
signed-by=/etc/apt/trusted.gpg.d/cran_ubuntu_key.asc] 
https://cloud.r-project.org/bin/linux/ubuntu jammy-cran40/" \
           | sudo tee -a /etc/apt/sources.list.d/cran.list \
##
## Update again and install R
   && sudo apt update -qqq \
   && sudo apt install --yes --no-install-recommends r-base-core


--
dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org

        [[alternative HTML version deleted]]

_______________________________________________
R-SIG-Debian mailing list
R-SIG-Debian@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-debian

Reply via email to