Building a container: Docker

Running Docker images in Singularity

Singularity can shell, import, run and exec a Docker image directly.

Info Docker is not required for running Docker images in Singularity.

singularity shell docker://ubuntu:latest
singularity run docker://ubuntu:latest
singularity exec docker://ubuntu:latest echo "Hello Cambridge!"

Converting a Docker image to a Singularity image

To import a docker image to a singularity image:

singularity image.create --size 4000 tensorflow.img
singularity import tensorflow.img docker://tensorflow/tensorflow:latest

The singularity create command by default will create an image of size 768MB, you can modify this by using --size or -s argument.

Converting a Docker specification file to a Singularity specification file

Just like Docker has the Dockerfile, Singularity has a file called Singularity. It is recommended to build Singularity images from the specification file.

Singularity-Hub converts Docker specification file to a Singularity file.

Warning Singularity does not currently support metadata, and so tags like MAINTAINER and LABEL are converted to comments.

Sample Docker file

Converted Singularity specification file

Last updated