Skip to content

Lab 07: Building Containers with Docker

Ryan edited this page Dec 20, 2023 · 13 revisions

Building Containers with Docker

So far we've been pulling existing signed images using Singularity. We've learned how to run these containers using shell and exec, and we've even seen that docker images usually seem to run fine via Singularity.

Although we could use a pre-existing container for the splice-aware alignment software STAR, we're going to create and host our own image using Docker. Why use Docker and not Singularity? Aside from gaining a well-rounded skillset, Docker seems to play well on both MacOS and Windows, while Singularity isn't yet optimized for MacOS.

Installing Docker Desktop and Creating DockerHub account

The following steps are completely optional, but if you foresee yourself creating custom images these practices should be beneficial.

First, you'll need to install the desktop app and CLI tools for Docker Desktop.

Then, you'll need to create a free account at DockerHub.

Creating an Image for STAR

Per the "COMPILING FROM SOURCE" documentation for STAR, we see:

git clone https://github.com/alexdobin/STAR.git

cd STAR/source
make STAR

This tells us that if we want to create an image from scratch, at bare minimum we will require git and make. If you've ever compiled software from source before, you know that the make command is dependent on your system's compiler and maybe a handful of other common development packages. Typically, software maintainers will provide a list of prerequisite packages to successfully compile from source. In reality, there will probably be some trial and error to discover the minimum set of packages required to get a package installed successfully. For example, STAR requires binutils, xxd, and _____ in addition to the typical packages for compilation.

Parts of a Dockerfile

The structure of a Dockerfile will depend on the requirements and intended application of the final image.

See best practices for more information.

In general, the potential parts of a Dockerfile are:

  • FROM
  • RUN

⚠️ Images require the package "procps" in order to run successfully in Nextflow.