I am looking for a way to check if a container is already cached from a hub url. For example I would want a command to do something like:
singularity iscached docker://username/container:tag
True
Any ideas?
Thanks!
I am looking for a way to check if a container is already cached from a hub url. For example I would want a command to do something like:
singularity iscached docker://username/container:tag
True
Any ideas?
Thanks!
You can use the command
singularity cache list --verbose | grep 'IMAGE_NAME.sif'
if that return code is 0, then the image exists. you can get the return code with $?. you will have to change names like docker://user/repo:tag into the sif filenames that singularity creates.
for example:
singularity cache list --verbose | grep 'alpine_latest.sif'
echo $? # prints 1
singularity pull docker://alpine:latest
singularity cache list --verbose | grep 'alpine_latest.sif'
echo $? # prints 0