What are Containers
The reproducibility problem
Section titled “The reproducibility problem”You build a variant calling pipeline on your laptop. It runs perfectly. You send it to a collaborator. It breaks immediately.
One possible cause is the environment. Your colleague has a different version
of samtools, a missing system library, or a reference index built with a
different bwa release. Code changes, input differences, and undocumented
parameters can also change the result.
A Snakemake or Nextflow pipeline records the analysis steps. To repeat those steps, a collaborator also needs the software environment, input data, reference files, and parameters.
What containers solve
Section titled “What containers solve”A container image can package the tools, libraries, and code used by an analysis. Running the same image preserves those installed versions on compatible hosts. The host must still provide a supported kernel, processor architecture, and any required devices or drivers.
Data and reference files usually remain outside the image. You mount them into the container and supply the analysis parameters at runtime. The image does not check whether those files are the correct inputs.
For example, an image containing STAR 2.7.11b supplies that version to each run. Changing its reference index or command arguments can still change the output.
Containers vs virtual machines
Section titled “Containers vs virtual machines”Containers and virtual machines both provide isolation. They differ in how much of the system they replicate.
A virtual machine runs a guest operating system with its own kernel. A Linux container shares the kernel of its Linux host. On macOS or Windows, a Linux virtual machine can provide that host.
Container images contain the application and its userspace dependencies. Their size depends on what they contain; a bioinformatics image with R, Bioconductor, Python, and reference data can occupy several gigabytes.
Why Podman over Docker
Section titled “Why Podman over Docker”These guides use Podman because it supports rootless operation and manages local containers without a persistent daemon. Docker also supports rootless mode, which runs its daemon and containers without root privileges. Access to a conventional rootful Docker daemon carries different permissions from rootless operation.
Podman uses OCI container images and supports familiar commands such as build,
pull, and run. Its command interface is similar to Docker’s, but flags,
network behavior, service integrations, and remote clients can differ. Check the
Podman manual
when adapting a command from another engine.
On an institutional cluster, use the container engine that the administrators support. Rootless operation still depends on host configuration and storage support. It does not grant permission to run Podman on every shared system.
Container images vs containers
Section titled “Container images vs containers”These two terms are easy to confuse.
An image is a template. It is a read-only snapshot of a file system containing your tools, libraries, and code. Images are what you build, share, and download.
A container is a running instance of an image. When you start an image, it becomes a container. You can run multiple containers from the same image. Each one is independent.
As an analogy: an image is like a genome reference file. A container is like an alignment job that uses that reference. You run many jobs against the same reference.
Where images come from
Section titled “Where images come from”You do not have to build every image from scratch. Public registries host thousands of pre-built images.
- Docker Hub is the largest and most well known registry. It hosts official images for tools like Python, R, and Ubuntu.
- Quay.io is a registry run by Red Hat. Many bioinformatics projects host their images here.
- GitHub Container Registry lets project maintainers publish images alongside their source code.
- BioContainers is the most relevant registry for bioinformatics. It provides pre-built images for thousands of tools including
samtools,bcftools,STAR,salmon,fastqc, and many more. If a tool is available through Bioconda, it almost certainly has a BioContainers image.
When you need a tool, check BioContainers first. Using a community-maintained image saves time and improves reproducibility across labs.
Installing Podman
Section titled “Installing Podman”On Ubuntu, install Podman with your package manager. This is one of the few commands in this tutorial that requires sudo:
sudo apt install podmanVerify the installation:
podman --versionYou should see output like podman version 4.9.3 or similar. The exact version number will vary.
Run Podman as your normal user for rootless operation. If the first container fails, check the host’s subordinate user and group IDs, storage setup, and the rootless requirements. An installed executable alone does not verify those requirements.
Next steps
Section titled “Next steps”Now that you understand what containers are and why they matter, the next page covers building your own container images.
Further reading
Section titled “Further reading”The Podman 4.9.3 manual describes rootless operation and its host requirements. It explains why installation alone does not establish that a host can run the example.
The build manual describes how an image is created from a build context. The run manual describes the resulting container, its process, and resources supplied at runtime.