This is a proof of concept for packaging a Singularity container in a Docker image, only with purpose to store it in a Docker Registry for pulling later. Of course you'd need Docker or a tool like oras to handle the pull. Use at your own risk! I don't know if there are rules against this sort of thing.
Build the Singularity container.
$ sudo singularity build busybox.sif SingularityThen test it:
$ ./busybox.sifthen build the docker container, giving the Singularity container as a build arg.
$ docker build -t vanessa/singularity-in-docker --build-arg container=busybox.sif .Make sure it's there:
$ docker run -it vanessa/singularity-in-docker
/ # ls /
bin dev home root tmp var
busybox.sif etc proc sys usrThen push to wherever you like! When it's time to pull and use:
$ docker pull vanessa/singularity-in-dockerYou can run with a different entrypoint, detached, to keep it running:
$ docker run -d --rm --name squiggles vanessa/singularity-in-docker tail -f /dev/nullThen copy the Singularity container:
$ docker cp squiggles:/busybox.sif exported-busybox.sifTada!
$ ./exported-busybox.sif
Run run run run runnnnn!And stop your squiggles.
$ docker stop squiggles