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 introduce the use of Docker and Singularity containers but the material will be of use for whatever container technology you plan to, or end up, using.

After completing this session you should:

  • Have an understanding of what Docker/Singularity containers are, why they are useful and the common terminology used
  • Have a working Docker installation on your local system to allow you to use containers
  • Understand how to use existing Docker containers for common tasks
  • Be able to build your own Docker/Singularity containers by understanding both the role of a Dockerfile/Singularity recipe in building containers, and the syntax used in Dockerfiles/Singularity recipes
  • Understand how to manage Docker/Singularity containers on your local system
  • Appreciate decisions that need to be made around containerising research workflows
  • Understand the differences between Docker and Singularity containers and why Singularity is more suitable for multi-user systems (e.g. HPC)
  • Appreciate issues around reproducibility in software, understand how containers can address some of these issues and what the limits to reproducibility using containers are

The material on this site corresponds to Day 1 of the course - covering Docker. Day 2 of the course will look at Singularity and the day 2 material is available on a separate site.


  • 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. We will also try to give command variants for Windows cmd.exe.
  • 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.


Setup Download files required for the lesson
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 know Docker is installed and running?
How do I interact with Docker?
10:30 3. Exploring and Running Containers How do I interact with Docker containers and container images on my computer?
11:00 4. Break Break
11:15 5. Cleaning Up Containers How do I interact with a Docker container on my computer?
How do I manage my containers and container images?
11:25 6. Finding Containers on Docker Hub What is the Docker Hub, and why is it useful?
11:45 7. Creating Your Own Container Images How can I make my own Docker container images?
How do I document the ‘recipe’ for a Docker container image?
12:15 8. Lunch Break
14:00 9. Creating More Complex Container Images How can I make more complex container images?
15:00 10. Break Break
15:15 11. 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?
15:35 12. Examples of Using Container Images in Practice How can I use Docker for my own work?
15:55 Finish

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