Create a Singularity container from Docker Hub¶
There are multiple ways how to create a Singularity container.
This page shows how to create a Singularity container from a Docker script on Docker Hub.
Procedure¶
The hardest part of this procedure may be to have Linux with Singularity installed on a computer where you have super-user rights.
In this example, we create a Singularity container for https://github.com/lindenb/jvarkit with a Docker Hub script at https://hub.docker.com/r/lindenb/jvarkit.
1. Create the Singularity container¶
Here we build a Singularity container from a Docker file:
The magic is in docker:[owner/file]
, which for us
becomes docker:lindenb/jvarkit
:
In some case, the Singularity container is now created.
How does that look like?
$ sudo singularity build my_container.sif docker:lindenb/jvarkit
INFO: Starting build...
INFO: Fetching OCI image...
28.2MiB / 28.2MiB [================================================================================================================================================] 100 % 2.5 MiB/s 0s
1.0GiB / 1.0GiB [==================================================================================================================================================] 100 % 2.5 MiB/s 0s
INFO: Extracting OCI image...
INFO: Inserting Singularity configuration...
INFO: Creating SIF file...
INFO: Build complete: my_container.sif
1.1 Troubleshooting¶
In our case, however, we get the MANIFEST_UNKNOWN
error:
[sudo] password for sven:
INFO: Starting build...
INFO: Fetching OCI image...
FATAL: While performing build: conveyor failed to get: GET https://index.docker.io/v2/lindenb/jvarkit/manifests/latest: MANIFEST_UNKNOWN: manifest unknown; unknown tag=latest
This means that Docker Hub cannot conclude with Docker script we want to use exactly. To solve this, we need to find a tag that allows us to find an exact script. On Docker Hub, we can find the tags for our Docker script ar https://hub.docker.com/r/lindenb/jvarkit/tags.
How does that page look like?
Here is how https://hub.docker.com/r/lindenb/jvarkit/tags looks like:
We can see there that 1b2aedf24
is the tag for the latest version.
How does that look like?
$ sudo singularity build my_container.sif docker:lindenb/jvarkit
INFO: Starting build...
INFO: Fetching OCI image...
28.2MiB / 28.2MiB [================================================================================================================================================] 100 % 2.5 MiB/s 0s
1.0GiB / 1.0GiB [==================================================================================================================================================] 100 % 2.5 MiB/s 0s
INFO: Extracting OCI image...
INFO: Inserting Singularity configuration...
INFO: Creating SIF file...
INFO: Build complete: my_container.sif
Works!
2. Use the Singularity container¶
For example, in this case:
However, this container is setup differently. From the documentation, one find that this container is used as such: