apptainer-delete
Remove Apptainer containers
TLDR
Delete an image from the Container Library
Delete an image for a specific architecture
[F]orce delete an image without confirmation
Delete an image from a specific library server
Delete an image using HTTP instead of HTTPS
Display help
SYNOPSIS
apptainer delete [options...] <imagePath> [<imagePath>...]
PARAMETERS
-f, --force
Force deletion, including non-empty directories.
-y, --yes
Automatically answer 'yes' to all confirmation prompts.
DESCRIPTION
The apptainer delete command removes Apptainer/Singularity Image Format (SIF) files and associated directories from the local cache or specified paths. It is essential for managing disk space by cleaning up unused container images after pulling, building, or converting them. By default, the command prompts for confirmation before deletion to prevent accidental removal of important images. It supports deleting multiple images in a single invocation, making it efficient for batch cleanup.
Use cases include freeing storage post-experimentation or when images are superseded. Note that it only affects local files and does not impact remote repositories. The command checks if the image is in use (e.g., mounted or running) and refuses deletion in such cases unless forced. Force mode bypasses some safety checks, like non-empty directories, but use cautiously to avoid data loss. Integrated with Apptainer's cache management, it respects the $APPTAINER_CACHEDIR environment variable.
CAVEATS
Cannot delete running instances or mounted images; stop them first with apptainer instance stop. Does not affect remote images or registries.
EXAMPLES
apptainer delete mycontainer.sif
Deletes a single SIF image with confirmation.
apptainer delete -y image1.sif image2.sif
Deletes multiple images without prompting.
apptainer delete -f ~/apptainer/images/*
Forces deletion of all cache images.
CACHE LOCATION
Defaults to $HOME/.apptainer/cache or $APPTAINER_CACHEDIR. Use apptainer cache clean for broader cache management.
HISTORY
Originated as singularity delete in Singularity (Sylabs, 2015). Renamed and enhanced in Apptainer (2021 fork of SingularityCE by community for open-source focus). Added force option in later versions for better cache management.
SEE ALSO
apptainer(1), apptainer-pull(1), apptainer-instance(1), rm(1)


