Skip to content

Instantly share code, notes, and snippets.

@phydev
Last active January 24, 2022 09:28
Show Gist options
  • Save phydev/5bffe25466dd5914ef7f15c7c6e37167 to your computer and use it in GitHub Desktop.
Save phydev/5bffe25466dd5914ef7f15c7c6e37167 to your computer and use it in GitHub Desktop.
How to install singularity in a debian machine and create a debian container.

Singularity

Debian installation

  1. Access the following helper to add the neurodebian repository in your apt list https://neuro.debian.net/install_pkg.html?p=fsl

I'm using Debian GNU/Linux 11.0 (bullseye) and a server in Munich.

apt install gnupg # required
wget -O- http://neuro.debian.net/lists/bullseye.de-m.full | sudo tee /etc/apt/sources.list.d/neurodebian.sources.list
sudo apt-key adv --recv-keys --keyserver hkps://keyserver.ubuntu.com 0xA5D32F012649A5A9
apt update
  1. Install the following packages:

apt install singularity-container

apt install debootstrap

  1. Create the following file:
  • debian.def
MirrorURL: http://deb.debian.org/debian
OSVersion: stable
Include: vim

%post
    apt -y update`
    apt -y install python3.9 python3-pip
  1. Execute the command bellow to create the container

sudo singulairity build --sandbox debian.sandbox debian.def

  1. Enter the container shell with writable mode to install other softwares

singularity shell --writable debian.sandbox

  1. When the container is ready, you can generate the image file:

sudo singularity build container.sif debian.sandbox

Build based on tensorflow docker image

  1. Write definition file:
  • bd4qol.def
Bootstrap: docker
From: tensorflow/tensorflow:latest

%post
   apt -y install sudo
   sudo pip3 install pandas scipy numpy seaborn shap missingpy

%labels
   Author Moreira-Soares, M
   Site https://phydev.github.io
   Project BD4QoL
   Version v1.0.0

%help
   Big Data for Quality of Life - BD4QoL
   This container contains python3 with:
   tensorflow, keras, pandas, scikit-learn, seaborn, numpy, scipy, missingpy and shap.
  1. Build

sudo singularity build bd4qol.sif bd4qol.def

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment