Here’s a minimal Apptainer (formerly Singularity) .def file to install an APT package in a Debian-based container:
Bootstrap: docker
From: debian:latest
%post
apt-get update && apt-get install -y <package-name>
Explanation:
Bootstrap: docker: Uses Docker as the bootstrap method.
From: debian:latest: Pulls the latest Debian image.
%post: Runs commands after the base image is built.
apt-get update: Updates the package list.
apt-get install -y <package-name>: Installs the specified package (replace <package-name> with your package, e.g., cowsay).
Example:
To install cowsay:
Bootstrap: docker
From: debian:latest
%post
apt-get update && apt-get install -y cowsay
Build the container with:
apptainer build my_container.sif my_container.def