Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Bash script wrapper for generating a singularity image from a local Docker image
# Based on
# Usage: bash mydockerimg mysingularity.simg
set -ueo pipefail
if [ -f $FILEOUT ]; then
echo "File $FILEOUT exists!"
exit 1
docker run -d -p $PORT:5000 --restart=always --name "registry-$IMG" registry:2
# Push local docker container to it
docker tag $IMG localhost:$PORT/$IMG
docker push localhost:$PORT/$IMG
# Build singularity container
SINGULARITY_NOHTTPS=1 singularity build $FILEOUT docker://localhost:$PORT/$IMG
docker rm -f "registry-$IMG"
docker rmi localhost:$PORT/$IMG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.