colima status
If not running, start it. Allocate sufficient resources.
- runtime docker: specifies using Docker (vs. containerd)
- cpu 6: Allocate 4 CPU cores to the VM. <redacted>iMac has 8
- memory 8: Allocate 8 GB RAM to the VM. <redacted>iMac has 16
- disk 50: Allocate 50 GB disk space to the VM. <redacted>iMac has 8 Adjust these values based on your Mac's resources and analysis needs.
colima start --runtime docker --cpu 6 --memory 10 --disk 100
Verify Docker is running and using the colima context
docker context ls
If 'colima' is not the current context (marked with *), switch to it:
docker context use colima
docker ps -a # Should show an empty list or existing containers
The && rm -rf /var/lib/apt/lists/* at the end ensures that the intermediate files created during the apt-get process are deleted to reduce image size in Docker.
# image: RNA-seq analysis sandbox
# This dockerfile is based on the one created by
# Titus Brown (available at https://github.com/ctb/2015-docker-building/blob/master/salmon/Dockerfile)
# Where dikip inspired by https://github.com/COMBINE-lab/salmon/blob/a2f6912b3f9f9af91e3a4b0d74adcb3bdc4c9a32/docker/Dockerfile
# Cant find 1.10.3 binary, but the dockerfile says so, so: ENV SALMON_VERSION 1.10.3
FROM ubuntu:24.04 as base
MAINTAINER [email protected]
ENV PACKAGES apt-get update && apt-get install -y --no-install-recommends \
git gcc make g++ libboost-all-dev liblzma-dev libbz2-dev \
zlib1g-dev libcurl4-openssl-dev curl unzip autoconf \
apt-transport-https gnupg software-properties-common wget
ENV SALMON_VERSION 1.10.3
# salmon binary will be installed in /home/salmon/bin/salmon
### don't modify things below here for version updates etc.
WORKDIR /home
RUN apt-get update && \
apt remove -y libcurl4 && \
apt-get install -y --no-install-recommends ${PACKAGES} && \
apt-get clean
RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | apt-key add -
RUN apt-add-repository 'deb https://apt.kitware.com/ubuntu/ noble main'
RUN apt-get update
# I commented the following command as its method is not listed in official tutorial: https://apt.kitware.com/
# RUN apt-key --keyring /etc/apt/trusted.gpg del C1F34CDD40CD72DA
# I tried to follow the tutorial after sudo apt-get update to before apt-get install kitware-archive-keyring.
RUN apt-get install ca-certificates gpg wget
RUN test -f /usr/share/doc/kitware-archive-keyring/copyright || \
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | \
gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg > /dev/null
RUN echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ noble main' | tee /etc/apt/sources.list.d/kitware.list >/dev/null
RUN apt-get update
RUN test -f /usr/share/doc/kitware-archive-keyring/copyright || rm /usr/share/keyrings/kitware-archive-keyring.gpg
RUN apt-get install kitware-archive-keyring
RUN apt-get install -y cmake
RUN curl -k -L https://github.com/COMBINE-lab/salmon/archive/v${SALMON_VERSION}.tar.gz -o salmon-v${SALMON_VERSION}.tar.gz && \
tar xzf salmon-v${SALMON_VERSION}.tar.gz && \
cd salmon-${SALMON_VERSION} && \
mkdir build && \
cd build && \
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/salmon && make && make install
# For dev version
# RUN git clone https://github.com/COMBINE-lab/salmon.git && \
# cd salmon && \
# git checkout develop && \
# mkdir build && \
# cd build && \
# cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local && make && make install
FROM ubuntu:24.04
RUN apt-get update && \
apt-get install -y --no-install-recommends libhwloc5 && \
rm -rf /var/lib/apt/lists/*
COPY --from=base /usr/local/salmon/ /usr/local/
ENV PATH /home/salmon-${SALMON_VERSION}/bin:${PATH}
ENV LD_LIBRARY_PATH "/usr/local/lib:${LD_LIBRARY_PATH}"
RUN echo "export PATH=$PATH" > /etc/environment
RUN echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH" > /etc/environment
# Update apt and install required helper packages
RUN apt update -qq && \
apt install -y --no-install-recommends software-properties-common dirmngr wget gpg && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Add the CRAN signing key and repository
RUN wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | \
gpg --dearmor -o /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc && \
echo "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/" > /etc/apt/sources.list.d/cran_r.list && \
apt update -qq && \
apt install -y --no-install-recommends r-base && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Install Python 3, pip, and venv
RUN apt-get update && \
apt-get install -y --no-install-recommends python3 python3-pip python3-venv && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Verify Python installation
RUN python3 --version && pip3 --version
# Install Quarto
RUN wget https://github.com/quarto-dev/quarto-cli/releases/download/v1.7.23/quarto-1.7.23-linux-arm64.deb -O quarto-installer.deb && \
dpkg -i quarto-installer.deb || apt-get install -f -y && \
rm quarto-installer.deb && \
quarto --version
Okay, this is an excellent direction! Using a Dockerfile
is definitely the standard and most robust way to create reproducible containerized environments, especially when installing multiple complex tools. It's great you were inspired by the official Salmon Dockerfile – learning from existing examples is key.
Your analysis of your manual steps being "untidy" is spot on; a Dockerfile
automates and documents that process cleanly. Let's refine the Dockerfile
you drafted. You've done a really good job merging the concepts!
Critique and Refinements for Your Draft Dockerfile:
You've correctly identified key elements like multi-stage builds, installing dependencies, and adding your specific tools (R, Python, Quarto). Here are some suggestions for improvement:
ENV PACKAGES
Syntax: The way you definedENV PACKAGES
includes theapt-get update/install
command itself.ENV
should just define the variable (the list of package names). The installation command goes in aRUN
instruction.apt remove -y libcurl4
: This was likely needed for Ubuntu 18.04 compatibility in the original Salmon Dockerfile. It's probably unnecessary and potentially problematic on Ubuntu 24.04. I'd recommend removing this line unless you specifically find it's needed.- Combining
RUN
Instructions: EachRUN
command creates a new layer in your Docker image. You can combine related commands using&& \
to reduce the number of layers and potentially the final image size. For example, groupapt-get update
,apt-get install
, andapt-get clean
together. - Setting PATH/LD_LIBRARY_PATH: The standard Docker way to set environment variables is using the
ENV
instruction, not by echoing into/etc/environment
./etc/environment
is typically read by login shells, which isn't how commands usually run inside Docker. Also, the paths need to correctly point to where Salmon (and its libraries) are copied in the final stage. - User Creation (
dikip
): Your manual steps included creating the userdikip
. Your Dockerfile currently doesn't! This means the container will run asroot
by default. It's strongly recommended to add the user creation steps and switch to that user using theUSER
instruction near the end of the Dockerfile. This avoids running processes as root and prevents the file permission issues on your mounted/data
volume we discussed earlier. - Hardcoded Versions/Arch: You've hardcoded the Quarto version (
1.7.23
) and architecture (arm64
). This is fine if you only build on ARM and always want that version, but for more flexibility, you could use build arguments (ARG
) to pass these in. For now, we'll leave it as is. libhwloc5
: This runtime dependency in the final stage was from the original Ubuntu 18.04 Dockerfile. It might have different names or not be needed at all on Ubuntu 24.04 for Salmon 1.10.3. You could try removing it and see if Salmon runs; if not, investigate the required runtime libraries for Salmon on 24.04. For now, we can try installing the likely equivalentlibhwloc15
.
Revised Dockerfile Incorporating Suggestions:
# syntax=docker/dockerfile:1
# Stage 1: Build Salmon
FROM ubuntu:24.04 as builder
# Set Noninteractive Frontend for apt commands
ENV DEBIAN_FRONTEND=noninteractive
# Define packages needed for building Salmon + CMake + general tools
# Note: libcurl4-openssl-dev provides libcurl functionality on modern Ubuntu
ENV BUILD_PACKAGES \
build-essential \
git \
make \
g++ \
libboost-all-dev \
liblzma-dev \
libbz2-dev \
zlib1g-dev \
libcurl4-openssl-dev \
curl \
unzip \
autoconf \
wget \
ca-certificates \
gnupg \
apt-transport-https \
software-properties-common
# Define Salmon version
ENV SALMON_VERSION=1.10.3
# Install build dependencies and Kitware key/repo for recent CMake
RUN apt-get update && \
apt-get install -y --no-install-recommends ${BUILD_PACKAGES} && \
# Add Kitware signing key (follow official method for noble)
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg > /dev/null && \
echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ noble main' | tee /etc/apt/sources.list.d/kitware.list > /dev/null && \
# Install specific keyring package and update apt cache
apt-get update && \
apt-get install -y kitware-archive-keyring && \
# Install CMake
apt-get install -y cmake && \
# Clean up apt cache
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Build Salmon
WORKDIR /tmp
RUN curl -k -L https://github.com/COMBINE-lab/salmon/archive/v${SALMON_VERSION}.tar.gz -o salmon-v${SALMON_VERSION}.tar.gz && \
tar xzf salmon-v${SALMON_VERSION}.tar.gz && \
cd salmon-${SALMON_VERSION} && \
mkdir build && \
cd build && \
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/salmon -DCMAKE_BUILD_TYPE=Release && \
make -j $(nproc) && \
make install && \
# Clean up source files
cd /tmp && \
rm -rf salmon-${SALMON_VERSION} salmon-v${SALMON_VERSION}.tar.gz
# Stage 2: Final Image
FROM ubuntu:24.04
# Set Noninteractive Frontend
ENV DEBIAN_FRONTEND=noninteractive
# Install runtime dependencies for Salmon (check if needed - libhwloc15 is the likely equivalent for 24.04)
# + other tools: R, Python, Quarto, sudo, git, etc.
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libhwloc15 \
libtbb2 \
# R dependencies
software-properties-common dirmngr \
# Python
python3 python3-pip python3-venv \
# General utilities
sudo wget curl nano git vim ca-certificates adduser gpg \
# Clean up build deps if any snuck in (unlikely here but good practice)
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Copy compiled Salmon from builder stage
COPY --from=builder /usr/local/salmon /usr/local/salmon
# Set PATH and LD_LIBRARY_PATH for Salmon
# Note: /usr/local/bin and /usr/local/lib are usually searched by default,
# but explicitly adding the salmon paths is safer.
ENV PATH="/usr/local/salmon/bin:${PATH}"
ENV LD_LIBRARY_PATH="/usr/local/salmon/lib:${LD_LIBRARY_PATH}"
# Install R from CRAN repository
RUN wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | gpg --dearmor -o /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc && \
echo "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/" | tee /etc/apt/sources.list.d/cran_r.list && \
apt-get update && \
apt-get install -y --no-install-recommends r-base r-base-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Install Quarto (using ARM64 version - adjust if needed)
ARG QUARTO_VERSION=1.4.554 # Use ARG for flexibility, set a default
ARG QUARTO_ARCH=arm64
RUN wget https://github.com/quarto-dev/quarto-cli/releases/download/v${QUARTO_VERSION}/quarto-${QUARTO_VERSION}-linux-${QUARTO_ARCH}.deb -O quarto-installer.deb && \
dpkg -i quarto-installer.deb || apt-get install -f -y && \
rm quarto-installer.deb && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Create the non-root user 'dikip' and give sudo privileges
RUN adduser --disabled-password --gecos "" dikip && \
adduser dikip sudo && \
echo 'dikip ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
# Switch to the non-root user
USER dikip
WORKDIR /home/dikip
# Verify installations (optional - runs as user dikip)
RUN echo "Verifying installations..." && \
python3 --version && \
pip3 --version && \
R --version && \
quarto --version && \
salmon --version && \
echo "Setup complete. Run container and navigate to /data for mounted volume."
# Set default command (optional) - keeps container running if needed
# CMD ["/bin/bash"]
How to Use This Dockerfile:
- Save: Save the content above into a file named
Dockerfile
(no extension) in an empty directory on your Mac. - Build: Open your Mac terminal (connected via SSH), navigate to the directory containing the
Dockerfile
, and run the build command:(Note thedocker build -t diki-rnaseq2 .
.
at the end - it tells Docker to use the current directory as the build context). This might take some time as it downloads the base image, installs packages, and compiles Salmon. - Run: Once the build is successful, you can run your container:
docker run -it --rm \ -v /Users/\<redacted\>/diki-analysis/RNAseq_20250410:/data \ --name my-analysis-session \ diki-rnaseq2 /bin/bash
-it
: Interactive terminal.--rm
: Automatically remove the container when you exit (good for testing).-v ...:/data
: Mount your data volume.--name ...
: Give the running container instance a name.diki-rnaseq2
: The name of the image you just built./bin/bash
: The command to run inside (starts a bash shell).
You should land in a bash shell as the dikip
user, inside the /home/dikip
directory, with R, Python, Quarto, and Salmon installed and ready to use, and your data available at /data
. This Dockerfile
approach is much more robust and reproducible!
# syntax=docker/dockerfile:1
# Stage 1: Build Salmon
FROM ubuntu:24.04 as builder
# Set Noninteractive Frontend for apt commands
ENV DEBIAN_FRONTEND=noninteractive
# Define packages needed for building Salmon + CMake + general tools
# Note: libcurl4-openssl-dev provides libcurl functionality on modern Ubuntu
ENV BUILD_PACKAGES \
build-essential \
git \
make \
g++ \
libboost-all-dev \
liblzma-dev \
libbz2-dev \
zlib1g-dev \
libcurl4-openssl-dev \
curl \
unzip \
autoconf \
wget \
ca-certificates \
gnupg \
apt-transport-https \
software-properties-common
# Define Salmon version
ENV SALMON_VERSION=1.10.3
# Install build dependencies and Kitware key/repo for recent CMake
RUN apt-get update && \
apt-get install -y --no-install-recommends ${BUILD_PACKAGES} && \
# Add Kitware signing key (follow official method for noble)
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg > /dev/null && \
echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ noble main' | tee /etc/apt/sources.list.d/kitware.list > /dev/null && \
# Install specific keyring package and update apt cache
apt-get update && \
apt-get install -y kitware-archive-keyring && \
# Install CMake
apt-get install -y cmake && \
# Clean up apt cache
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Build Salmon
WORKDIR /tmp
RUN curl -k -L https://github.com/COMBINE-lab/salmon/archive/v${SALMON_VERSION}.tar.gz -o salmon-v${SALMON_VERSION}.tar.gz && \
tar xzf salmon-v${SALMON_VERSION}.tar.gz && \
cd salmon-${SALMON_VERSION} && \
mkdir build && \
cd build && \
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/salmon -DCMAKE_BUILD_TYPE=Release && \
make -j $(nproc) && \
make install && \
# Clean up source files
cd /tmp && \
rm -rf salmon-${SALMON_VERSION} salmon-v${SALMON_VERSION}.tar.gz
# Stage 2: Final Image
FROM ubuntu:24.04
# Set Noninteractive Frontend
ENV DEBIAN_FRONTEND=noninteractive
# Install runtime dependencies for Salmon (check if needed - libhwloc15 is the likely equivalent for 24.04)
# + other tools: R, Python, Quarto, sudo, git, etc.
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libhwloc15 \
libtbb2 \
# R dependencies
software-properties-common dirmngr \
# Python
python3 python3-pip python3-venv \
# General utilities
sudo wget curl nano git vim ca-certificates adduser gpg \
# Clean up build deps if any snuck in (unlikely here but good practice)
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Copy compiled Salmon from builder stage
COPY --from=builder /usr/local/salmon /usr/local/salmon
# Set PATH and LD_LIBRARY_PATH for Salmon
# Note: /usr/local/bin and /usr/local/lib are usually searched by default,
# but explicitly adding the salmon paths is safer.
ENV PATH="/usr/local/salmon/bin:${PATH}"
ENV LD_LIBRARY_PATH="/usr/local/salmon/lib:${LD_LIBRARY_PATH}"
# Install R from CRAN repository
RUN wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | gpg --dearmor -o /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc && \
echo "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/" | tee /etc/apt/sources.list.d/cran_r.list && \
apt-get update && \
apt-get install -y --no-install-recommends r-base r-base-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Install Quarto (using ARM64 version - adjust if needed)
ARG QUARTO_VERSION=1.4.554 # Use ARG for flexibility, set a default
ARG QUARTO_ARCH=arm64
RUN wget https://github.com/quarto-dev/quarto-cli/releases/download/v${QUARTO_VERSION}/quarto-${QUARTO_VERSION}-linux-${QUARTO_ARCH}.deb -O quarto-installer.deb && \
dpkg -i quarto-installer.deb || apt-get install -f -y && \
rm quarto-installer.deb && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Create the non-root user 'dikip' and give sudo privileges
RUN adduser --disabled-password --gecos "" dikip && \
adduser dikip sudo && \
echo 'dikip ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
# Switch to the non-root user
USER dikip
WORKDIR /home/dikip
# Verify installations (optional - runs as user dikip)
RUN echo "Verifying installations..." && \
python3 --version && \
pip3 --version && \
R --version && \
quarto --version && \
salmon --version && \
echo "Setup complete. Run container and navigate to /data for mounted volume."
# Set default command (optional) - keeps container running if needed
# CMD ["/bin/bash"]
Make sure you know where you are in the Mac:
pwd
#> /Users/\<redacted\>/diki-analysis/
mkdir diki-rnaseq2-docker && cd diki-rnaseq2-docker
touch Dockerfile
nano Dockerfile
Paste the Dockerfile above. Then,
docker build --tag diki-rnaseq2 .
then,
docker run -it --rm \
-v /Users/\<redacted\>/diki-analysis/RNAseq_20250410:/data \
diki-rnaseq2 /bin/bash
I also fix the Salmon version to 1.10.1
# image: RNA-seq analysis sandbox
# This dockerfile is based on the one created by
# Titus Brown (available at https://github.com/ctb/2015-docker-building/blob/master/salmon/Dockerfile)
# Where dikip inspired by https://github.com/COMBINE-lab/salmon/blob/a2f6912b3f9f9af91e3a4b0d74adcb3bdc4c9a32/docker/Dockerfile
# Cant find 1.10.3 binary, but the dockerfile says so, so: ENV SALMON_VERSION 1.10.3
# Stage 1: Build Salmon
FROM ubuntu:24.04 AS base
MAINTAINER [email protected]
# Set Noninteractive Frontend for apt commands
ENV DEBIAN_FRONTEND=noninteractive
# Define package list (just names) - Corrected Syntax
ENV PACKAGES="git gcc make g++ libboost-all-dev liblzma-dev libbz2-dev zlib1g-dev libcurl4-openssl-dev curl unzip autoconf apt-transport-https gnupg software-properties-common wget"
ENV SALMON_VERSION=1.10.1
WORKDIR /home
# Install build dependencies - Corrected RUN command
RUN apt-get update && \
# apt remove -y libcurl4 && \ # Suggest removing for Ubuntu 24.04
apt-get install -y --no-install-recommends ${PACKAGES} && \
apt-get clean && rm -rf /var/lib/apt/lists/*
# --- Start of Kitware / CMake installation (as provided by user) ---
RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | apt-key add -
RUN apt-add-repository 'deb https://apt.kitware.com/ubuntu/ noble main'
RUN apt-get update
RUN apt-get install ca-certificates gpg wget
RUN test -f /usr/share/doc/kitware-archive-keyring/copyright || \
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | \
gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg > /dev/null
RUN echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ noble main' | tee /etc/apt/sources.list.d/kitware.list >/dev/null
RUN apt-get update
RUN test -f /usr/share/doc/kitware-archive-keyring/copyright || rm /usr/share/keyrings/kitware-archive-keyring.gpg
RUN apt-get install kitware-archive-keyring
RUN apt-get install -y cmake
# --- End of Kitware / CMake installation ---
# --- Start of Salmon Build (as provided by user - KNOWN TO BE FAILING CURRENTLY) ---
WORKDIR /tmp # Changed WORKDIR for build isolation
RUN curl -k -L https://github.com/COMBINE-lab/salmon/archive/refs/tags/v${SALMON_VERSION}.tar.gz -o salmon-v${SALMON_VERSION}.tar.gz && \
tar xzf salmon-v${SALMON_VERSION}.tar.gz && \
cd salmon-${SALMON_VERSION} && \
mkdir build && \
cd build && \
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/salmon && \
# NOTE: The following 'make' command is where the build previously failed (Error 2)
make -j $(nproc) && \
make install && \
# Clean up source files
cd /tmp && \
rm -rf salmon-${SALMON_VERSION} salmon-v${SALMON_VERSION}.tar.gz
# --- End of Salmon Build ---
# Stage 2: Final Image
FROM ubuntu:24.04
# Set Noninteractive Frontend
ENV DEBIAN_FRONTEND=noninteractive
# Install runtime dependencies + tools
# User removed libhwloc/libtbb, only install essential utils here initially
RUN apt-get update && \
apt-get install -y --no-install-recommends \
sudo wget curl nano git vim ca-certificates adduser gpg software-properties-common dirmngr \
python3 python3-pip python3-venv \
&& apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Copy compiled Salmon from builder stage
COPY --from=base /usr/local/salmon /usr/local/salmon
# Set PATH and LD_LIBRARY_PATH for Salmon (Using standard ENV)
ENV PATH="/usr/local/salmon/bin:${PATH}"
# Setting LD_LIBRARY_PATH explicitly, ignore warning if base doesn't have it set
ENV LD_LIBRARY_PATH="/usr/local/salmon/lib:${LD_LIBRARY_PATH}"
# Install R from CRAN (adding r-base-dev suggested)
RUN wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | gpg --dearmor -o /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc && \
echo "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/" | tee /etc/apt/sources.list.d/cran_r.list && \
apt-get update -qq && \
apt-get install -y --no-install-recommends r-base r-base-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Verify R Installation
RUN R --version
# Install Quarto (Adjust version/arch if needed)
ARG QUARTO_VERSION=1.4.554 # Updated to latest stable ARG
ARG QUARTO_ARCH=arm64
RUN wget https://github.com/quarto-dev/quarto-cli/releases/download/v${QUARTO_VERSION}/quarto-${QUARTO_VERSION}-linux-${QUARTO_ARCH}.deb -O quarto-installer.deb && \
dpkg -i quarto-installer.deb || (apt-get update && apt-get install -f -y) && \
rm quarto-installer.deb && \
# Clean up apt cache after potential -f install
apt-get clean && rm -rf /var/lib/apt/lists/*
# Verify Python and Quarto
RUN python3 --version && pip3 --version && quarto --version
# Create the non-root user 'dikip' and give sudo privileges
RUN adduser --disabled-password --gecos "" dikip && \
adduser dikip sudo && \
echo 'dikip ALL=(ALL) NOPASSWD:ALL' | tee /etc/sudoers.d/dikip-sudo
# Switch to the non-root user
USER dikip
WORKDIR /home/dikip
# Final Verification Step (as user dikip)
RUN echo "Verifying installations as user $(whoami)..." && \
which R && \
which python3 && \
which quarto && \
which salmon && \
echo "Setup complete. Container will run as user $(whoami). Mount data to /data."
# CMD ["/bin/bash"]
Gave up and decided to use miniconda instead.
Dockerfile from Gemini
# image: RNA-seq analysis sandbox - Salmon via Miniconda
# Base image
FROM ubuntu:24.04
MAINTAINER [email protected]
# Set Noninteractive Frontend for apt commands
ENV DEBIAN_FRONTEND=noninteractive
# Install essential tools, R dependencies, Python, basic build tools (for R packages), and conda deps
RUN apt-get update && \
apt-get install -y --no-install-recommends \
sudo wget curl nano git vim ca-certificates adduser gpg \
software-properties-common dirmngr \
python3 python3-pip python3-venv \
bzip2 \
# Minimal build tools often needed for R/Python package installations
build-essential \
# Libraries needed by some R/Python packages
libssl-dev libxml2-dev libcurl4-openssl-dev \
&& apt-get clean && \
rm -rf /var/lib/apt/lists/*
# --- Salmon build section (build deps, cmake, source build) is now REMOVED ---
# Install R from CRAN (adding r-base-dev suggested)
RUN wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | gpg --dearmor -o /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc && \
echo "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/" | tee /etc/apt/sources.list.d/cran_r.list && \
apt-get update -qq && \
apt-get install -y --no-install-recommends r-base r-base-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Verify R Installation
RUN R --version
# Install Quarto (Adjust version/arch if needed)
# Using ARG allows overriding version/arch during build if needed: docker build --build-arg QUARTO_VERSION=x.y.z ...
ARG QUARTO_VERSION=1.4.554
ARG QUARTO_ARCH=arm64
RUN wget https://github.com/quarto-dev/quarto-cli/releases/download/v${QUARTO_VERSION}/quarto-${QUARTO_VERSION}-linux-${QUARTO_ARCH}.deb -O quarto-installer.deb && \
dpkg -i quarto-installer.deb || (apt-get update && apt-get install -f -y) && \
rm quarto-installer.deb && \
# Clean up apt cache after potential -f install
apt-get clean && rm -rf /var/lib/apt/lists/*
# Verify Python and Quarto
RUN python3 --version && pip3 --version && quarto --version
# Create the non-root user 'dikip' and give sudo privileges
RUN adduser --disabled-password --gecos "" dikip && \
adduser dikip sudo && \
echo 'dikip ALL=(ALL) NOPASSWD:ALL' | tee /etc/sudoers.d/dikip-sudo
# Switch to the non-root user
USER dikip
WORKDIR /home/dikip
# Install Miniconda for the dikip user
# Remember: We need the aarch64 version for ARM Macs
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-aarch64.sh -O ~/miniconda.sh && \
bash ~/miniconda.sh -b -p $HOME/miniconda && \
rm ~/miniconda.sh && \
# Add conda to PATH and initialize it (for the dikip user's bash shell)
echo '. $HOME/miniconda/etc/profile.d/conda.sh' >> ~/.bashrc && \
echo 'export PATH="$HOME/miniconda/bin:$PATH"' >> ~/.bashrc && \
# Initialize conda for interactive use (writes to .bashrc) - Run directly using shell
/bin/bash -c ". $HOME/miniconda/etc/profile.d/conda.sh && conda init bash"
# Set PATH explicitly for subsequent RUN commands in this Dockerfile stage
# Note: ~/.bashrc is not sourced by default in non-interactive RUN commands
ENV PATH="/home/dikip/miniconda/bin:${PATH}"
# Install Salmon using Conda (specify version, use bioconda/conda-forge)
ARG SALMON_VERSION=1.10.1
RUN conda config --add channels defaults && \
conda config --add channels bioconda && \
conda config --add channels conda-forge && \
conda config --set channel_priority strict && \
conda install -y salmon=${SALMON_VERSION} && \
# Clean up conda cache to reduce image size
conda clean -a -y
# Final Verification Step (as user dikip)
RUN echo "Verifying installations as user $(whoami)..." && \
which R && \
which python3 && \
which quarto && \
which salmon && \
echo "--- Versions ---" && \
R --version | head -n 1 && \
python3 --version && \
quarto --version && \
salmon --version && \
echo "Setup complete. Container will run as user $(whoami). Mount data to /data."
# Set default command to bash
CMD ["/bin/bash"]
Change the Quarto version
# image: RNA-seq analysis sandbox - Salmon via Miniconda
# Base image
FROM ubuntu:24.04
MAINTAINER [email protected]
# Set Noninteractive Frontend for apt commands
ENV DEBIAN_FRONTEND=noninteractive
# Install essential tools, R dependencies, Python, basic build tools (for R packages), and conda deps
RUN apt-get update && \
apt-get install -y --no-install-recommends \
sudo wget curl nano git vim ca-certificates adduser gpg \
software-properties-common dirmngr \
python3 python3-pip python3-venv \
bzip2 \
# Minimal build tools often needed for R/Python package installations
build-essential \
# Libraries needed by some R/Python packages
libssl-dev libxml2-dev libcurl4-openssl-dev \
&& apt-get clean && \
rm -rf /var/lib/apt/lists/*
# --- Salmon build section (build deps, cmake, source build) is now REMOVED ---
# Install R from CRAN (adding r-base-dev suggested)
RUN wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | gpg --dearmor -o /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc && \
echo "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/" | tee /etc/apt/sources.list.d/cran_r.list && \
apt-get update -qq && \
apt-get install -y --no-install-recommends r-base r-base-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Verify R Installation
RUN R --version
# Install Quarto (Adjust version/arch if needed)
# Using ARG allows overriding version/arch during build if needed: docker build --build-arg QUARTO_VERSION=x.y.z ...
ARG QUARTO_VERSION=1.7.23
ARG QUARTO_ARCH=arm64
RUN wget https://github.com/quarto-dev/quarto-cli/releases/download/v${QUARTO_VERSION}/quarto-${QUARTO_VERSION}-linux-${QUARTO_ARCH}.deb -O quarto-installer.deb && \
dpkg -i quarto-installer.deb || (apt-get update && apt-get install -f -y) && \
rm quarto-installer.deb && \
# Clean up apt cache after potential -f install
apt-get clean && rm -rf /var/lib/apt/lists/*
# Verify Python and Quarto
RUN python3 --version && pip3 --version && quarto --version
# Create the non-root user 'dikip' and give sudo privileges
RUN adduser --disabled-password --gecos "" dikip && \
adduser dikip sudo && \
echo 'dikip ALL=(ALL) NOPASSWD:ALL' | tee /etc/sudoers.d/dikip-sudo
# Switch to the non-root user
USER dikip
WORKDIR /home/dikip
# Install Miniconda for the dikip user
# Remember: We need the aarch64 version for ARM Macs
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-aarch64.sh -O ~/miniconda.sh && \
bash ~/miniconda.sh -b -p $HOME/miniconda && \
rm ~/miniconda.sh && \
# Add conda to PATH and initialize it (for the dikip user's bash shell)
echo '. $HOME/miniconda/etc/profile.d/conda.sh' >> ~/.bashrc && \
echo 'export PATH="$HOME/miniconda/bin:$PATH"' >> ~/.bashrc && \
# Initialize conda for interactive use (writes to .bashrc) - Run directly using shell
/bin/bash -c ". $HOME/miniconda/etc/profile.d/conda.sh && conda init bash"
# Set PATH explicitly for subsequent RUN commands in this Dockerfile stage
# Note: ~/.bashrc is not sourced by default in non-interactive RUN commands
ENV PATH="/home/dikip/miniconda/bin:${PATH}"
# Install Salmon using Conda (specify version, use bioconda/conda-forge)
ARG SALMON_VERSION=1.10.1
RUN conda config --add channels defaults && \
conda config --add channels bioconda && \
conda config --add channels conda-forge && \
conda config --set channel_priority strict && \
conda install -y salmon=${SALMON_VERSION} && \
# Clean up conda cache to reduce image size
conda clean -a -y
# Final Verification Step (as user dikip)
RUN echo "Verifying installations as user $(whoami)..." && \
which R && \
which python3 && \
which quarto && \
which salmon && \
echo "--- Versions ---" && \
R --version | head -n 1 && \
python3 --version && \
quarto --version && \
salmon --version && \
echo "Setup complete. Container will run as user $(whoami). Mount data to /data."
# Set default command to bash
CMD ["/bin/bash"]
I immediately change the Quarto version and updating script to install Salmon via miniconda. Also add another r2u for richer CRAN in ubuntu
# image: RNA-seq analysis sandbox - Salmon via Miniconda
# Base image
FROM ubuntu:24.04
MAINTAINER [email protected]
# Set Noninteractive Frontend for apt commands
ENV DEBIAN_FRONTEND=noninteractive
# Install essential tools, R dependencies, Python, basic build tools (for R packages), and conda deps
RUN apt-get update && \
apt-get install -y --no-install-recommends \
sudo wget curl nano git vim ca-certificates adduser gpg \
software-properties-common dirmngr \
python3 python3-pip python3-venv \
bzip2 \
# Minimal build tools often needed for R/Python package installations
build-essential \
# Libraries needed by some R/Python packages
libssl-dev libxml2-dev libcurl4-openssl-dev \
&& apt-get clean && \
rm -rf /var/lib/apt/lists/*
# --- Salmon build section (build deps, cmake, source build) is now REMOVED ---
# Install R from CRAN (using modern signed-by method) - CORRECTED BLOCK
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates wget gpg && \
mkdir -p /usr/share/keyrings && \
wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | gpg --dearmor -o /usr/share/keyrings/cran-archive-keyring.gpg && \
chmod 644 /usr/share/keyrings/cran-archive-keyring.gpg && \
echo "deb [signed-by=/usr/share/keyrings/cran-archive-keyring.gpg] https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/" | tee /etc/apt/sources.list.d/cran_r.list > /dev/null && \
apt-get update -qq && \
apt-get install -y --no-install-recommends r-base r-base-dev && \
apt update -qq && apt install --yes --no-install-recommends wget ca-certificates gnupg && \
wget -q -O- https://eddelbuettel.github.io/r2u/assets/dirk_eddelbuettel_key.asc | \
tee -a /etc/apt/trusted.gpg.d/cranapt_key.asc && \
echo "deb [arch=arm64] https://r2u.stat.illinois.edu/ubuntu noble main" \
> /etc/apt/sources.list.d/cranapt.list && \
apt update -qq && \
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 && \
echo "deb [arch=arm64] https://cloud.r-project.org/bin/linux/ubuntu jammy-cran40/" \
> /etc/apt/sources.list.d/cran_r.list && \
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys \
67C2D66C4B1D4339 51716619E084DAB9 && \
apt update -qq && \
DEBIAN_FRONTEND=noninteractive apt install --yes --no-install-recommends r-base-core && \
echo "Package: *" > /etc/apt/preferences.d/99cranapt && \
echo "Pin: release o=CRAN-Apt Project" >> /etc/apt/preferences.d/99cranapt && \
echo "Pin: release l=CRAN-Apt Packages" >> /etc/apt/preferences.d/99cranapt && \
echo "Pin-Priority: 700" >> /etc/apt/preferences.d/99cranapt && \
apt install --yes --no-install-recommends python3-{dbus,gi,apt} && \
## Then install bspm (as root) and enable it, and enable a speed optimization
Rscript -e 'install.packages("bspm")' && \
RHOME=$(R RHOME) && \
echo "suppressMessages(bspm::enable())" >> ${RHOME}/etc/Rprofile.site && \
echo "options(bspm.version.check=FALSE)" >> ${RHOME}/etc/Rprofile.site && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Verify R Installation
RUN R --version
# Install Quarto (Adjust version/arch if needed)
# Using ARG allows overriding version/arch during build if needed: docker build --build-arg QUARTO_VERSION=x.y.z ...
ARG QUARTO_VERSION=1.7.23
ARG QUARTO_ARCH=arm64
RUN wget https://github.com/quarto-dev/quarto-cli/releases/download/v${QUARTO_VERSION}/quarto-${QUARTO_VERSION}-linux-${QUARTO_ARCH}.deb -O quarto-installer.deb && \
dpkg -i quarto-installer.deb || (apt-get update && apt-get install -f -y) && \
rm quarto-installer.deb && \
# Clean up apt cache after potential -f install
apt-get clean && rm -rf /var/lib/apt/lists/*
# Verify Python and Quarto
RUN python3 --version && pip3 --version && quarto --version
# Create the non-root user 'dikip' and give sudo privileges
RUN adduser --disabled-password --gecos "" dikip && \
adduser dikip sudo && \
echo 'dikip ALL=(ALL) NOPASSWD:ALL' | tee /etc/sudoers.d/dikip-sudo
# Switch to the non-root user
USER dikip
WORKDIR /home/dikip
# Install Miniconda for the dikip user
# Remember: We need the aarch64 version for ARM Macs
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-aarch64.sh -O ~/miniconda.sh && \
bash ~/miniconda.sh -b -p $HOME/miniconda && \
rm ~/miniconda.sh && \
# Add conda to PATH and initialize it (for the dikip user's bash shell)
echo '. $HOME/miniconda/etc/profile.d/conda.sh' >> ~/.bashrc && \
echo 'export PATH="$HOME/miniconda/bin:$PATH"' >> ~/.bashrc && \
# Initialize conda for interactive use (writes to .bashrc) - Run directly using shell
/bin/bash -c ". $HOME/miniconda/etc/profile.d/conda.sh && conda init bash"
# Set PATH explicitly for subsequent RUN commands in this Dockerfile stage
# Note: ~/.bashrc is not sourced by default in non-interactive RUN commands
ENV PATH="/home/dikip/miniconda/bin:${PATH}"
# Install Salmon using Conda (specify version, use bioconda/conda-forge)
ARG SALMON_VERSION=1.10.1
RUN conda config --add channels defaults && \
conda config --add channels bioconda && \
conda config --add channels conda-forge && \
conda config --set channel_priority strict && \
conda install -y bioconda::salmon && \
# Clean up conda cache to reduce image size
conda clean -a -y
# Final Verification Step (as user dikip)
RUN echo "Verifying installations as user $(whoami)..." && \
which R && \
which python3 && \
which quarto && \
which salmon && \
echo "--- Versions ---" && \
R --version | head -n 1 && \
python3 --version && \
quarto --version && \
salmon --version && \
echo "Setup complete. Container will run as user $(whoami). Mount data to /data."
# Set default command to bash
CMD ["/bin/bash"]
Make sure you know where you are in the Mac:
pwd
#> /Users/\<redacted\>/diki-analysis/
mkdir diki-rnaseq2-docker && cd diki-rnaseq2-docker
touch Dockerfile
nano Dockerfile
Paste the Dockerfile above. Then,
docker build --no-cache --tag diki-rnaseq2 .
It is important to run with --no-cache so that we know WHOLE dockerfile is funcitional as one instruction!
If there is an error or the build fail, make sure with ls
there is no other file than "Dockerfile", and open
Dockerfile with
vim Dockerfile
# then press vvVG to select all of the text, and paste the new one with Ctrl + V
Then,
docker run -it --rm \
-v /Users/\<redacted\>/diki-analysis/RNAseq_20250410:/data \
--name diki-rnaseq2 \
diki-rnaseq2 /bin/bash
docker build --tag
will appear as IMAGE information in docker ps
, while
docker run --name
will appear as NAMES information in the docker ps
.
That is how --tag
inform different thing than --name
.