aka Lightweight virtualisation
As a software:
Recipe file:
Dockerfile
docker commit
$ docker run biocorecrg/c4lwg-2018 /bin/echo "Hello world!"$ docker run -d --name mycontainer biocorecrg/c4lwg-2018 /bin/sh -c "while true; do echo hello world; sleep 1; done"$ docker psRun daemon
List runninng containers
Log and info of container
$ docker log mycontainer
$ docker inspect mycontainerActions on containers
$ docker stop mycontainer
$ docker start mycontainer
$ docker restart mycontainer$ docker exec mycontainer /bin/echo "Bye, moon!"$ docker run -ti mycontainer2 /bin/bashExecute on a running container
Run a container interactively (from the beginning). Stops when exiting
$ docker exec -ti mycontainer /bin/bashExecute on a running container interactively
$ docker rm mycontainer
$ docker rmi myimage$ docker ps -aremove container, remove image
list all containers (even stopped ones)
Examples:
Repository of bioinformatics containers
$ docker pull biocorecrg/debian-perlbrew:stretch$ docker push myusername/mysexyimagedownload image
upload image
containers for HPC
Summarising
As of 2.4.x version
For local Docker images: https://github.com/singularityware/docker2singularity
BootStrap: docker
From: biocorecrg/c4lwg-2018
%runscript
echo "Welcome to C4LWG-2018 Singularity Image"
%post
echo "C4LWG-2018 image built"BootStrap: debootstrap
OSVersion: xenial
MirrorURL: http://fr.archive.ubuntu.com/ubuntu/
Include: build-essential curl python python-dev openjdk-8-jdk bzip2 zip unzip
%runscript
echo "Welcome to Ubuntu C4LWG-2018 Singularity Image"
%post
FASTQC_VERSION=0.11.5
MULTIQC_VERSION=1.5
BOWTIE_VERSION=1.2.1.1
cd /usr/local; curl -k -L https://www.bioinformatics.babraham.ac.uk/projects/fastqc/fastqc_v${FASTQC_VERSION}.zip > fastqc.zip
cd /usr/local; unzip fastqc.zip; rm fastqc.zip; chmod 775 FastQC/fastqc; ln -s /usr/local/FastQC/fastqc /usr/local/bin/fastqc
cd /usr/local; curl --fail --silent --show-error --location --remote-name https://github.com/BenLangmead/bowtie/releases/download/v$BOWTIE_VERSION/bowtie-${BOWTIE_VERSION}-linux-x86_64.zip
cd /usr/local; unzip -d /usr/local bowtie-${BOWTIE_VERSION}-linux-x86_64.zip
cd /usr/local; rm bowtie-${BOWTIE_VERSION}-linux-x86_64.zip
cd /usr/local/bin; ln -s ../bowtie-${BOWTIE_VERSION}/bowtie* .
curl --fail --silent --show-error --location --remote-name https://bootstrap.pypa.io/get-pip.py
python get-pip.py
pip install numpy matplotlib
pip install -I multiqc==${MULTIQC_VERSION}
echo "C4LWG-2018 image built"
%labels
Maintainer Biocorecrg
Version 0.1.0$ singularity build c4lwg-2018.simg docker://biocorecrg/c4lwg-2018$ sudo singularity build --writable c4lwg-2018.img docker://biocorecrg/c4lwg-2018Build read-only image from Docker (Squash FS)
Build writable image from Docker (ext3 FS)
Build from recipe
$ sudo singularity build c4lwg-2018.xenial.simg Singularity.xenial$ singularity exec c4lwg-2018.simg /bin/echo 'Hello world'$ singularity exec -e c4lwg-2018.simg /bin/echo 'Hello world'Execute a command
Execute a command (with clean environment)
Execute a shell
$ singularity shell c4lwg-2018.simg$ singularity run c4lwg-2018.simgExecute defined runscript (parameters can be used)