Converting a Dockerfile into a “Singularity” file?

5,700 views
Skip to first unread message

Evan

unread,
Apr 12, 2018, 12:06:45 PM4/12/18
to singularity
Both Docker and Singularity are excellent tools, and I use them both. I have far less experience with Singularity however. 

We all know that if you have a `Dockerfile`, you can build the image with the command `docker build .`

I'm currently in the situation whereby I have the Dockerfile already created, and I would like to use this file for Singularity, and build. 

Based on this documentation: https://singularity.lbl.gov/docs-docker

> Just like Docker has the Dockerfile, Singularity has a file called
> Singularity that (currently) applications like Singularity Hub know to
> sniff for. For reproducibility of your containers, our strong
> recommendation is that you build from these files.

it looks like one has to build an entire Singularity file from scratch. 

(1) Is there a standard method for converting Dockerfiles to Singularity files? 

(2) It's unclear from me what the equivalent of `docker build .` is in this context, or how the various arguments of `docker build` (e.g. `-f`, `-t`, etc.) translate in this context

For a Singularity file `SFile`, it looks like it is:

sudo singularity build container_name SFile





v

unread,
Apr 12, 2018, 12:40:34 PM4/12/18
to singu...@lbl.gov
Hi Evan,

1) Standard method for conversion

If you have a Docker image, you can use it directly with Singularity:

     singularity shell docker://ubuntu

But if you want direct conversion of the actual recipe, that is a different thing! This is not a "standard" but the spython tool has a function that will let you do this. Generally you could do something like:
   
spython recipe Dockerfile >> Singularity.snowflake

If you see any issues / bugs, please report an issue on the board here https://github.com/singularityhub/singularity-cli and I'd be glad to help!

2) Equivalent of docker build

We have a singularity build too!! --> http://singularity.lbl.gov/docs-build as you've found!  The arguments from docker don't map exactly (you don't need to specify -f if the file isn't named Singularity, just point to the file you want) so this would work:

sudo singularity build container_name SFile

The Singularity convention is to help with automatic detection of recipes in Github, etc.

Best,

Vanessa

--
You received this message because you are subscribed to the Google Groups "singularity" group.
To unsubscribe from this group and stop receiving emails from it, send an email to singularity+unsubscribe@lbl.gov.



--
Vanessa Villamia Sochat
Stanford University '16
Reply all
Reply to author
Forward
0 new messages