Skip to content

What are Containers

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.

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 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.

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.

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.

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.

On Ubuntu, install Podman with your package manager. This is one of the few commands in this tutorial that requires sudo:

Terminal window
sudo apt install podman

Verify the installation:

Terminal window
podman --version

You 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.

Now that you understand what containers are and why they matter, the next page covers building your own container images.

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.