Where Do Images Come From?
Before getting into examples, it is worth discussing where container images come from, in general. As mentioned, images are pulled from repositories and registries online. These images were created by users and uploaded to those registries.
In this topic, we do not go into the details of how to create a container image for yourself. Instead, we only briefly sketch a couple of the ways you can create one of your own (below). Afterward, we will assume that a container that meets your needs (or close to one) is already available from a registry, or from a shared file.
Building Images from Definition Files
To create an Apptainer image for a container, you need to create a definition file. The definition file is like a recipe; it outlines the series of steps that are used to build up the image. It starts by specifying which base image should be used. The various container platforms offer several different base images you could choose from. These are very pared-down, lightweight versions of different Linux operating systems. For instance, you could start with an Ubuntu base, specify certain package and libraries to install in it, copy data files into it, change the file permissions, and then run it. That builds up an image, which you could then upload to a registry so that others could pull it back down as needed.
Building Images from Dockerfiles
Simiarly, a Docker container is created from a definition file called a Dockerfile. It follows the same idea as an Apptainer definition file, where you specify a base image and then a series of steps to build up the image. For a walkthrough of writing and building a Dockerfile, see TACC's Build from a Dockerfile.
Converting Docker/OCI Images to SIF
Let's say you used the Docker platform to build your image and uploaded it to a Docker registry. When you pull it using Apptainer, you will actually be pulling the Docker image, which will then be converted automatically into the SIF format that Apptainer uses. There will be a little extra processing that happens after the image has been downloaded. This is also what happens with OCI images, which are based on an open-source image standard similar to Docker.
Sharing SIF Files Directly
If you have a SIF file in hand, you can share that file with someone just like any other file. You could either grant them access to the file through a shared file system, or copy the file through services like Globus.
CVW material development is supported by NSF OAC awards 1854828, 2321040, 2323116 (UT Austin) and 2005506 (Indiana University)