Apptainer (and singularity) can interact with container registries, much like docker can. Common practice for these registries is to have a (semantic version) tag for each image pushed and maintain the tag "latest" to point to the most recent version.
In apptainer, the tag is part of the target URI in the push
command:
apptainer push /path/to/mycontainer_v1.2.1.sif oras://registry.tld/foo/mycontainer:1.2.1
As near as I can tell, if I want my "latest" tag to be the same as 1.2.1, the only way to accomplish this is to upload the image twice, wasting both bandwidth for the upload and storage space in the registry, which may not be insignificant when images often run to several GB.
Is there a way to define tag aliases without uploading and storing multiple copies of the container image? If it's registry-dependent, I am specifically interested in solutions relevant to the gitlab container registry.
As far as I can tell, there is no way to do this with apptainer directly. There is however an oras
client for interacting with OCI registries, and it does have a tag
option that does exactly what I want.
oras login -u user -p token registry.gitlab.com
oras://
as one would use with apptainer remote login
will not work)oras repo tags registry.gitlab.com/owner/repo/image
oras tag registry.gitlab.com/owner/repo/image:tag1 tag2