Created
October 2, 2025 11:06
-
-
Save lquenti/a330883605b7c03f6d80bdd803124a4b to your computer and use it in GitHub Desktop.
Building Singularity from Docker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # 2023 Lars Quentin MIT | |
| # Call it with | |
| # ./scriptname ./path/to/your/Dockerfile | |
| # | |
| if [ "$EUID" -ne 0 ] | |
| then echo "Please run as root" | |
| exit | |
| fi | |
| if [ $# -ne 1 ] | |
| then echo "USAGE: ./scriptname ./path/to/your/Dockerfile" | |
| exit | |
| fi | |
| docker_filename="./build/docker_.tar.gz" | |
| singularity_filename="./build/singularity_.sif" | |
| sudo rm -rf ./build | |
| mkdir build | |
| docker save "$(sudo docker build -q -f $1 .)" -o $docker_filename && \ | |
| singularity build $singularity_filename docker-archive://$docker_filename |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment