rstudio/r4.6.1:2026.07.1-147
Version sha256.3330a88f9142a15d6cee9a542ac91c0bee129ea42ea5d5244a1e82421502e689
Image size: 4.8 GB
For more on pulling from the registry, see the ilifu documentation.
First, once: add the registry and make it your default
singularity remote add --no-login idia-registry https://sregistry.idia.ac.za
singularity remote use idia-registry
If you added it before, as the ilifu docs describe, remote add says it already exists: just run remote use.
Log in, for a private collection
singularity remote login idia-registry
Paste a token from your token page when asked. Public collections need no login.
Pull the container
singularity pull library://rstudio/r4.6.1:sha256.3330a88f9142a15d6cee9a542ac91c0bee129ea42ea5d5244a1e82421502e689
Shell into the container
singularity shell library://rstudio/r4.6.1:sha256.3330a88f9142a15d6cee9a542ac91c0bee129ea42ea5d5244a1e82421502e689
Run the container
singularity run library://rstudio/r4.6.1:sha256.3330a88f9142a15d6cee9a542ac91c0bee129ea42ea5d5244a1e82421502e689
First, once: add the registry and make it your default
apptainer remote add --no-login idia-registry https://sregistry.idia.ac.za
apptainer remote use idia-registry
If you added it before, as the ilifu docs describe, remote add says it already exists: just run remote use.
Log in, for a private collection
apptainer remote login idia-registry
Paste a token from your token page when asked. Public collections need no login.
Pull the container
apptainer pull library://rstudio/r4.6.1:sha256.3330a88f9142a15d6cee9a542ac91c0bee129ea42ea5d5244a1e82421502e689
Shell into the container
apptainer shell library://rstudio/r4.6.1:sha256.3330a88f9142a15d6cee9a542ac91c0bee129ea42ea5d5244a1e82421502e689
Run the container
apptainer run library://rstudio/r4.6.1:sha256.3330a88f9142a15d6cee9a542ac91c0bee129ea42ea5d5244a1e82421502e689
RStudio 2026.07.1-147 container, built with R 4.6.1
RStudio Server is licensed under the AGPLv3 and R under the GPL. The licence texts and
source details are in /usr/lib/rstudio-server/COPYING and SOURCE, and in /usr/share/R/doc;
the source code is linked from this image's RStudio_Source and R_Source labels.
This image has 3 apps. Pick one to see how to use it.
singularity run --app R library://rstudio/r4.6.1:sha256.3330a88f9142a15d6cee9a542ac91c0bee129ea42ea5d5244a1e82421502e689
This works once you've added the registry as a remote (see the CLI tab). Add the app's arguments after the command. With Apptainer, start it with apptainer instead.
Runs
exec R "${@}"
singularity run --app Rscript library://rstudio/r4.6.1:sha256.3330a88f9142a15d6cee9a542ac91c0bee129ea42ea5d5244a1e82421502e689
This works once you've added the registry as a remote (see the CLI tab). Add the app's arguments after the command. With Apptainer, start it with apptainer instead.
Runs
exec Rscript "${@}"
singularity run --app rstudio library://rstudio/r4.6.1:sha256.3330a88f9142a15d6cee9a542ac91c0bee129ea42ea5d5244a1e82421502e689
This works once you've added the registry as a remote (see the CLI tab). Add the app's arguments after the command. With Apptainer, start it with apptainer instead.
Runs
if [ -z "${RSTUDIO_PASSWORD}" ]; then
RSTUDIO_PASSWORD=$( tr -cd '[:alnum:]' < /dev/urandom | fold -w30 | head -n1 )
export RSTUDIO_PASSWORD
echo "The environment variable RSTUDIO_PASSWORD was not set, so your password has been chosen for you. It's: ${RSTUDIO_PASSWORD}"
fi
PORT=$( python -c 'import socket; s=socket.socket(); s.bind(("", 0)); print(s.getsockname()[1]); s.close()' )
HOST=$( /bin/hostname )
echo "Running rserver on port ${PORT}"
echo "To connect to this server run this on your local machine:"
echo " ssh -A ${USER}@${HOST} -o \"ProxyCommand=ssh ${USER}@slurm.ilifu.ac.za nc ${HOST} 22\" -L8081:localhost:${PORT}"
echo "then visit http://localhost:8081 in your browser and use the username \"${USER}\" to login with the password \"${RSTUDIO_PASSWORD}\""
echo "(You may need to choose a different port (other than 8081), so remember to change this in both the ssh and browser)"
exec rserver --server-user ${USER} --auth-none 0 --auth-pam-helper rstudio_auth --secure-cookie-key-file ${HOME}/.RStudio.rserver/secure-cookie.key --www-port ${PORT} --server-data-dir ${HOME}/.RStudio.rserver/data "${@}"
Bootstrap: library
Library: https://sregistry.idia.ac.za
From: ci-bot/ubuntu/noble-compile:0.3
%labels
Maintainer IDIA <support@ilifu.ac.za>
R_Version 4.6.1
RStudio_Version 2026.07.1-147
RStudio_Source https://github.com/rstudio/rstudio/tree/v2026.07.1+147
R_Source https://cran.r-project.org/src/base/R-4/R-4.6.1.tar.gz
%help
RStudio 2026.07.1-147 container, built with R 4.6.1
RStudio Server is licensed under the AGPLv3 and R under the GPL. The licence texts and
source details are in /usr/lib/rstudio-server/COPYING and SOURCE, and in /usr/share/R/doc;
the source code is linked from this image's RStudio_Source and R_Source labels.
%apprun R
exec R "${@}"
%apprun Rscript
exec Rscript "${@}"
%apprun rstudio
if [ -z "${RSTUDIO_PASSWORD}" ]; then
RSTUDIO_PASSWORD=$( tr -cd '[:alnum:]' < /dev/urandom | fold -w30 | head -n1 )
export RSTUDIO_PASSWORD
echo "The environment variable RSTUDIO_PASSWORD was not set, so your password has been chosen for you. It's: ${RSTUDIO_PASSWORD}"
fi
PORT=$( python -c 'import socket; s=socket.socket(); s.bind(("", 0)); print(s.getsockname()[1]); s.close()' )
HOST=$( /bin/hostname )
echo "Running rserver on port ${PORT}"
echo "To connect to this server run this on your local machine:"
echo " ssh -A ${USER}@${HOST} -o \"ProxyCommand=ssh ${USER}@slurm.ilifu.ac.za nc ${HOST} 22\" -L8081:localhost:${PORT}"
echo "then visit http://localhost:8081 in your browser and use the username \"${USER}\" to login with the password \"${RSTUDIO_PASSWORD}\""
echo "(You may need to choose a different port (other than 8081), so remember to change this in both the ssh and browser)"
exec rserver --server-user ${USER} --auth-none 0 --auth-pam-helper rstudio_auth --secure-cookie-key-file ${HOME}/.RStudio.rserver/secure-cookie.key --www-port ${PORT} --server-data-dir ${HOME}/.RStudio.rserver/data "${@}"
%runscript
if [ -z "${RSTUDIO_PASSWORD}" ]; then
RSTUDIO_PASSWORD=$( tr -cd '[:alnum:]' < /dev/urandom | fold -w30 | head -n1 )
export RSTUDIO_PASSWORD
echo "The environment variable RSTUDIO_PASSWORD was not set, so your password has been chosen for you. It's: ${RSTUDIO_PASSWORD}"
fi
PORT=$( python -c 'import socket; s=socket.socket(); s.bind(("", 0)); print(s.getsockname()[1]); s.close()' )
HOST=$( /bin/hostname )
echo "Running rserver on port ${PORT}"
echo "To connect to this server run this on your local machine:"
echo " ssh -A ${USER}@${HOST} -o \"ProxyCommand=ssh ${USER}@slurm.ilifu.ac.za nc ${HOST} 22\" -L8081:localhost:${PORT}"
echo "then visit http://localhost:8081 in your browser and use the username \"${USER}\" to login with the password \"${RSTUDIO_PASSWORD}\""
echo "(You may need to choose a different port (other than 8081), so remember to change this in both the ssh and browser)"
exec rserver --server-user ${USER} --auth-none 0 --auth-pam-helper rstudio_auth --secure-cookie-key-file ${HOME}/.RStudio.rserver/secure-cookie.key --www-port ${PORT} --server-data-dir ${HOME}/.RStudio.rserver/data "${@}"
%environment
export R_VERSION=4.6.1
export RSTUDIO_VERSION=2026.07.1-147
export PATH=/usr/lib/rstudio-server/bin:${PATH}
%post
# Create Installation Directories and export paths. This is needed as part of post.
# %environment scriptlet does not define these paths during %post, only after.
export R_VERSION=4.6.1
export RSTUDIO_VERSION=2026.07.1-147
export DEBIAN_FRONTEND=noninteractive
# The base image's sources.list has only the release pocket, so without these the
# upgrade below finds no updates.
. /etc/os-release
echo "deb http://us.archive.ubuntu.com/ubuntu ${VERSION_CODENAME}-updates main restricted universe" >> /etc/apt/sources.list
echo "deb http://security.ubuntu.com/ubuntu ${VERSION_CODENAME}-security main restricted universe" >> /etc/apt/sources.list
# Update apt
apt-get update -y && apt-get upgrade -y && apt-get dist-upgrade -y
apt-get install -y \
apt-utils \
build-essential \
dirmngr \
git \
imagemagick \
libfribidi-dev \
libharfbuzz-dev \
pandoc \
python-is-python3 \
pkg-config \
texlive \
texlive-extra-utils \
texlive-fonts-extra \
texlive-latex-extra \
texlive-pictures \
texlive-pstricks \
texlive-publishers \
texlive-science \
texlive-xetex \
ca-certificates \
gdebi-core \
systemd \
wget \
# Add R repositories
wget -qO- 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/"
apt update
# Install R and requirements
apt-get install -y --no-install-recommends \
ca-certificates \
gdebi-core \
hdf5-tools \
libcairo2-dev \
libcurl4-openssl-dev \
libfontconfig-dev \
libfreetype-dev \
libfribidi-bin \
libfribidi-dev \
libgit2-dev \
libgsl27 \
libgsl-dev \
libharfbuzz-dev \
libhdf5-dev \
libjpeg-dev \
libnetcdf-dev \
libpng-dev \
libssl-dev \
libtiff5-dev \
libuv1-dev \
libxml2-dev \
libxt-dev \
netcdf-bin \
patchelf \
r-base=${R_VERSION}* \
r-base-core=${R_VERSION}* \
r-base-dev=${R_VERSION}* \
r-recommended=${R_VERSION}* \
r-base-html=${R_VERSION}* \
r-doc-html=${R_VERSION}* \
systemd \
wget \
apt-mark hold r-base*
# Add a default CRAN mirror
echo "options(repos = c(CRAN = 'https://cran.rstudio.com/'), download.file.method = 'libcurl')" >> /usr/lib/R/etc/Rprofile.site
# Add a directory for host R libraries
mkdir -p /library
echo "R_LIBS_SITE=/library:\${R_LIBS_SITE}" >> /usr/lib/R/etc/Renviron.site
# rserver's --auth-pam-helper: checks the login against RSTUDIO_PASSWORD.
# Thanks to nickjer for this! https://github.com/nickjer/singularity-rstudio/blob/master/Singularity.3.6.0
mkdir -p /usr/lib/rstudio-server/bin
cat > /usr/lib/rstudio-server/bin/rstudio_auth <<'EOF'
#!/usr/bin/env bash
# Confirm username is supplied
if [[ $# -lt 1 ]]; then
echo "Usage: auth USERNAME"
exit 1
fi
USERNAME="${1}"
# Confirm password environment variable exists
if [[ -z "${RSTUDIO_PASSWORD}" ]]; then
echo "The environment variable RSTUDIO_PASSWORD is not set"
exit 1
fi
# Read in the password from user
read -s -p "Password: " PASSWORD
echo ""
# Authenticate user
if [[ "${USER}" == "${USERNAME}" && "${PASSWORD}" == "${RSTUDIO_PASSWORD}" ]]; then
echo "Successful authentication"
exit 0
else
echo "Invalid authentication"
exit 1
fi
EOF
chmod 755 /usr/lib/rstudio-server/bin/rstudio_auth
cd /tmp || exit 1
wget https://download2.rstudio.org/server/jammy/amd64/rstudio-server-${RSTUDIO_VERSION}-amd64.deb
gdebi -n rstudio-server-${RSTUDIO_VERSION}-amd64.deb
rm rstudio-server-${RSTUDIO_VERSION}-amd64.deb
# install a few basics
Rscript -e 'install.packages(
c(
"circlize",
"data.table",
"devtools",
"DBI",
"gprofiler2",
"mgcv",
"nlme",
"pacman",
"rmarkdown",
"Rcpp",
"shiny",
"tidyverse",
"xtable"
), Ncpus=parallel::detectCores())'
Rscript -e 'update.packages(ask=FALSE)'
Rscript -e 'devtools::install_github("hadley/devtools")'
mkdir -p /var/run/rstudio-server
chmod ugo+w /var/run/rstudio-server
chmod +t /var/run/rstudio-server
Rscript -e 'install.packages("BiocManager", Ncpus=parallel::detectCores())'
Rscript -e 'BiocManager::install(ask=FALSE, update=TRUE)'
Rscript -e 'BiocManager::install(
pkgs = c("DESeq2", "edgeR", "limma", "MethylSeekR", "methylKit", "bsseq"),
dependencies = TRUE, Ncpus=parallel::detectCores()
)'
Rscript -e 'install.packages(
pkgs = "bcbioRNASeq",
repos = c(
"https://r.acidgenomics.com",
BiocManager::repositories()
),
dependencies = TRUE, Ncpus=parallel::detectCores()
)'
Rscript -e 'install.packages(
pkgs = "DESeqAnalysis",
repos = c(
"https://r.acidgenomics.com",
BiocManager::repositories()
),
dependencies = TRUE, Ncpus=parallel::detectCores()
)'
# Cleanup the container
apt-get clean
apt-get autoclean
%test
R_VERSION=4.6.1
R --version | grep -q "${R_VERSION}"
Download rstudio-r4.6.1_2026.07.1-147.def
#!/bin/sh
if [ -z "${RSTUDIO_PASSWORD}" ]; then
RSTUDIO_PASSWORD=$( tr -cd '[:alnum:]' < /dev/urandom | fold -w30 | head -n1 )
export RSTUDIO_PASSWORD
echo "The environment variable RSTUDIO_PASSWORD was not set, so your password has been chosen for you. It's: ${RSTUDIO_PASSWORD}"
fi
PORT=$( python -c 'import socket; s=socket.socket(); s.bind(("", 0)); print(s.getsockname()[1]); s.close()' )
HOST=$( /bin/hostname )
echo "Running rserver on port ${PORT}"
echo "To connect to this server run this on your local machine:"
echo " ssh -A ${USER}@${HOST} -o \"ProxyCommand=ssh ${USER}@slurm.ilifu.ac.za nc ${HOST} 22\" -L8081:localhost:${PORT}"
echo "then visit http://localhost:8081 in your browser and use the username \"${USER}\" to login with the password \"${RSTUDIO_PASSWORD}\""
echo "(You may need to choose a different port (other than 8081), so remember to change this in both the ssh and browser)"
exec rserver --server-user ${USER} --auth-none 0 --auth-pam-helper rstudio_auth --secure-cookie-key-file ${HOME}/.RStudio.rserver/secure-cookie.key --www-port ${PORT} --server-data-dir ${HOME}/.RStudio.rserver/data "${@}"
#!/bin/sh
R_VERSION=4.6.1
R --version | grep -q "${R_VERSION}"
# /.singularity.d/env/90-environment.sh
#!/bin/sh
# Custom environment shell code should follow
export INSTALLER_PATH=/installer
export SOFTWARE_PATH=/software
export PATH=${SOFTWARE_PATH}/bin:${PATH}
export LC_ALL=C
unset XDG_RUNTIME_DIR
export INSTALLER_PATH=/installer
export SOFTWARE_PATH=/software
export PATH=${SOFTWARE_PATH}/bin:${PATH}
export LD_LIBRARY_PATH=${SOFTWARE_PATH}/lib:${LD_LIBRARY_PATH}
export LIBRARY_PATH=${SOFTWARE_PATH}/lib:${LIBRARY_PATH}
export CPATH=${SOFTWARE_PATH}/include:${CPATH}
export INCLUDE=${SOFTWARE_PATH}/include/:${INCLUDE}
export PKG_CONFIG_PATH=${SOFTWARE_PATH}/lib/pkgconfig:${PKG_CONFIG_PATH}
export LC_ALL=C
unset XDG_RUNTIME_DIR
export R_VERSION=4.6.1
export RSTUDIO_VERSION=2026.07.1-147
export PATH=/usr/lib/rstudio-server/bin:${PATH}