Coder Social home page Coder Social logo

matthewgiarra / docker2singularity Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 16 KB

Export Docker image as Singularity .sif file in one line, without needing singularity installed locally. Uses https://github.com/singularityhub/docker2singularity.

License: Creative Commons Zero v1.0 Universal

Shell 100.00%

docker2singularity's Introduction

docker2singularity

This script exports a Docker image as a Singularity .sif file. This can be useful for porting Dockerized code to run on shared user systems like clusters, which sometimes run Singularity rather than Docker.

Prerequisites

  • Install Docker (tested on Mac OS 10.14.6 with Docker 20.10.6)

Usage

  1. Build or pull the Docker image you wish to export to a Singularity .sif file

    docker pull ubuntu:latest
  2. Run docker2singularity.sh to export the image as a .sif file

    cd docker2singularity
    ./docker2singularity.sh ubuntu

    This should write a file called ubuntu.sif in the current working directory, e.g., docker2singularity/ubuntu.sif

    Optionally, you can specify where to save the output .sif file:

    ./docker2singularity.sh ubuntu $HOME/ubuntu_singularity.sif

    Expected Output

    If it worked, you'll see output similiar to the following:

    Exporting docker image ubuntu --> /Users/matt/ubuntu_singularity.sif 
    
    Image Format: squashfs
    Docker Image: ubuntu
    Container Name: ubuntu_singularity.sif
    
    Inspected Size: 73 MB
    
    (1/10) Creating a build sandbox...
    (2/10) Exporting filesystem...
    (3/10) Creating labels...
    (4/10) Adding run script...
    (5/10) Setting ENV variables...
    (6/10) Adding mount points...
    (7/10) Fixing permissions...
    (8/10) Stopping and removing the container...
    (9/10) Building squashfs container...
    INFO:    Starting build...
    INFO:    Creating SIF file...
    INFO:    Build complete: /tmp/ubuntu_singularity.sif
    (10/10) Moving the image to the output folder...
         27,717,632 100%   80.25MB/s    0:00:00 (xfr#1, to-chk=0/1)
    Final Size: 27MB
     Exported Docker image ubuntu --> /Users/matt/ubuntu_singularity.sif 
    

    Help

    Run ./docker2singularity -h to print the help screen, including usage.

Caveats

In order to export a Docker image to .sif file, one of the following must be true:

  1. The Docker image is available locally (i.e., it has already been built using docker build or pulled using docker pull)

  2. A file named Dockerfile exists in the current working directory.

If a Dockerfile is found, you are given the option to build the docker image and then export it to .sif.

If neither of these conditions is met, an error message is printed and the program exits without doing anything.

docker2singularity's People

Contributors

matthewgiarra avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.