Introduction
In this lesson, we'll explore:
-
What containers are and how they differ from virtual machines.
-
How to install Docker and run a pre-built container.
-
How to describe, build, and run a container that includes SSH.
The goal of this tutorial is to get a local container running that the user can SSH into, so that they can run this SSH tutorial even without cluster credentials.
Prerequisites
If you are new to programming, it's recommended that you first take a few minutes to go over this short lesson talking about how to read technical documentation.
You'll also need a basic understanding of the Unix shell. If you're unfamiliar with the Unix shell, review the Unix Shell tutorial by Software Carpentry.
Why Containers?
Docker is a tool which allows users to build, share, package, verify, and run applications in isolated environments called containers while avoiding the tedium of environment configuration and management.
It's not uncommon when programming collaboratively that something that works well on one user's environment will run into issues when another user tries to run the same steps. Docker solves this problem by having dependencies and environment settings bundled together in a portable format. Whether you're developing from your personal laptop, running code on a high performance computing cluster, or deploying to production servers, Docker helps to ensure that the environment stays consistent.
Containers are lightweight and fast, built to share the host's operating system's kernel rather than running full virtual machines. This makes them ideal for testing software in clean environments.
By the end of this lesson, you should have a working understanding of how to use an existing Docker file to run a service with SSH. If you want to continue to learn more about Docker after this lesson here are some additional resources:
-
The Carpentries Community Lessons. Use the search box at the bottom to search "containers" to find more relevant lessons.
-
The HSF Training Center. Articles of interest to you may be the ones for Docker, Singularity, and Reproducible Analysis with REANA.
-
How Containers Work! by Julia Evans. If you really want to understand how containers work, this is the best resource available.
Let's continue to the next section to begin learning about container images and containers.