Skip to content

Instantly share code, notes, and snippets.

@lquenti
Created October 2, 2025 11:06
Show Gist options
  • Select an option

  • Save lquenti/a330883605b7c03f6d80bdd803124a4b to your computer and use it in GitHub Desktop.

Select an option

Save lquenti/a330883605b7c03f6d80bdd803124a4b to your computer and use it in GitHub Desktop.
Building Singularity from Docker
#!/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