Introducing Containers
- Almost all software depends on other software components to function, but these components have independent evolutionary paths.
- Small environments that contain only the software that is needed for a given task are easier to replicate and maintain.
- Critical systems that cannot be upgraded, due to cost, difficulty, etc. need to be reproduced on newer systems in a maintainable and self-documented way.
- Virtualization allows multiple environments to run on a single computer.
- Containerization improves upon the virtualization of whole computers by allowing efficient management of the host computer’s memory and storage resources.
- Containers are built from ‘recipes’ that define the required set of software components and the instructions necessary to build/install them within a container image.
- Podman is just one software platform that can create containers and the resources they use.
Introducing the Podman Command Line
- You will typically interact with Podman using the command line.
- To learn how to run a certain Podman command, we can type the
command followed by the
--helpflag.
Exploring and Running Containers
- The
podman image pullcommand downloads container images from the internet. - The
podman image lscommand lists Podman container images that are (now) on your computer. - The
podman container runcommand creates running containers from container images and can run commands inside them. - When using the
podman container runcommand, a container can run a default action (if it has one), a user specified action, or a shell to be used interactively.
Cleaning Up Containers
-
podman containerhas subcommands used to interact and manage containers. -
podman imagehas subcommands used to interact and manage container images. -
podman container lsorpodman pscan provide information on currently running containers.
Finding Containers on a Registry
- A container registry is an online repository of container images.
- “Docker Hub is the most widely used container registry.”
- Many Docker Hub container images are public, and may be officially endorsed.
- Each Docker Hub page about a container image provides structured information and subheadings
- Most Docker Hub pages about container images contain sections that provide examples of how to use those container images.
- Many Docker Hub container images have multiple versions, indicated by tags.
- The naming convention for Docker container images when using Podman
is:
docker.io/OWNER/CONTAINER_IMAGE_NAME:TAG
Creating Your Own Container Images
-
Dockerfiles specify what is within container images. - The
podman image buildcommand is used to build a container image from aDockerfile. - You can share your container images through the Docker Hub so that others can create containers from your container images.
Creating More Complex Container Images
- Podman allows containers to read and write files from the Podman host.
- You can include files from your Podman host into your container
images by using the
COPYinstruction in yourDockerfile.
Examples of Using Container Images in Practice
- There are many ways you might use Docker and existing container images in your research project.
Containers in Research Workflows: Reproducibility and Granularity
- Container images allow us to encapsulate the computation (and data) we have used in our research.
- Using a service such as Docker Hub allows us to easily share computational work we have done.
- Using container images along with a DOI service such as Zenodo allows us to capture our work and enables reproducibility.