Reproducible Computational Environments Using Containers: Introduction to Docker and Singularity


This course aims to introduce the use of containers with the goal of using them to effect reproducible computational environments. Such environments are useful for ensuring reproducible research outputs and for simplifying the setup of complex software dependencies across different systems. The course will mostly be based around the use of Docker containers but the material will be of use for whatever container technology you plan to, or end up, using. We will also briefly introduce the Singularity container environment which is compatible with Docker and designed for use on multi-user systems (such as HPC resources). On completion of this course attendees should:

General Information

Where: This course will be taught online via Blackboard Collaborate. All attendees will be sent the joining link prior to the event.

When: 10:00-16:00 GMT, 8 - 9 December 2020. Add to your Google Calendar.

Requirements: Participants must bring a laptop with a Mac, Linux, or Windows operating system (not a tablet, Chromebook, etc.) that they have administrative privileges on. They should have a few specific software packages installed (listed below). They are also required to abide by the ARCHER2 Training Code of Conduct.

Accessibility: We are committed to making this workshop accessible to everybody.

Materials will be provided in advance of the workshop and large-print handouts are available if needed by notifying the organizers in advance. If we can help making learning easier for you please get in touch (using contact details below) and we will attempt to provide them.

Contact: Please email for more information.


  • You should have basic familiarity with using a command shell, and the lesson text will at times request that you “open a shell window”, with an assumption that you know what this means.
    • Under Linux or macOS it is assumed that you will access a bash shell (usually the default), using your Terminal application.
    • Under Windows, Powershell and Git Bash should allow you to use the Unix instructions.
  • As an item of setup, it is assumed that you have a directory named container-playground that you are able to cd to using your command shell, and are also able to find using your computer’s graphical file browser (e.g., Finder on macOS or Windows Explorer). A simple way to achieve this is to create your container-playground directory within your computer’s Desktop folder. (See the Software Carpentry Shell lesson for more details.)
  • The lessons will sometimes request that you use a text editor to create or edit files in particular directories. It is assumed that you either have an editor that you know how to use that runs within the working directory of your shell window (e.g. nano), or that if you use a graphical editor, that you can use it to read and write files into the working directory of your shell.

Getting Started

To get started, follow the directions on the Setup page to ensure you have installed the Docker software, have registered for a Dockerhub account, have an SSH client available and have registered a user account on ARCHER2 (the HPC facility we will be using for the Singularity part of the course).

Collaborative Document

During the course, we will make use of a collaborative document known as an Etherpad. You can find the document at:


Setup Download files required for the lesson
Day 1 10:00 1. Introducing Containers What are containers, and why might they be useful to me?
10:20 2. Introducing the Docker command line How do I interact with Docker?
10:30 3. Break Break
10:45 4. Exploring and Running Containers How do I interact with a Docker container on my computer?
11:15 5. Finding Containers on the Docker Hub What is the Docker Hub, and why is it useful?
11:35 6. Cleaning Up Containers How do I interact with a Docker container on my computer?
11:45 7. Creating your own container images How can I make my own Docker images?
12:20 8. Lunch Break
14:05 9. Creating More Complex Container Images How can I make more complex container images?
15:05 10. Break Break
15:20 11. Containers used in generating this lesson How can containers be useful to me for building websites?
15:40 12. Containers in research workflows: reproducibility and granularity How can I use container images to make my research more reproducible?
How do I incorporate containers into my research workflow?
What are container orchestration tools and how can they potentially help me?
16:00 Finish
Day 2 10:00 13. Singularity: Getting started What is Singularity and why might I want to use it?
10:50 14. Break Break
11:05 15. Working with Singularity containers How do I run a shell or different commands within a container?
Where does Singularity store images?
12:00 16. Lunch Break
14:00 17. Building Singularity images How do I create my own Singularity images?
15:00 18. Running MPI parallel jobs using Singularity containers How do I set up and run an MPI job from a Singularity container?
16:00 Finish

The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor.