The commands we provided might contain hidden characters. If a copy-pasted command does not run, use this page to clean up the command line: https://biohpc.cornell.edu/clean.aspx
1.1 Two base images can be used for building Conda in Docker: continuumio/miniconda3 and mambaorg/micromamba. Here you will use continuumio/miniconda3.
1.2 Start a bash shell inside the container.
Do you see "(base) " in the bash prompt? That is because in this container, "miniconda3" would automatically start in the "base" environment.
1.3 Install some Conda packages into the container
1.4 Python3 and pip3 are pre-installed. You can use "pip" to install Python modules in the same Conda environment.
1.5 Inside the container, the Conda directory is "/opt/conda", not the usual "~/miniconda3"
1.6 After you install all the Conda packages, make sure to exit the container bash shell, and commit the container to a new Docker image.
Also, it is a good idea to save a tar file of the image.
1.7 Run software in Conda
2.1 Build a Singularity .sif file from the Docker .tar file
2.2 Run software in Singularity
In this exercise, run samtools to convert a sam file into a bam file.
2.2.1 Try the short form of the command
This short command should work on Singularity version 3.5 installed on BioHPC CentOS 7 servers. But not in the Rocky 9 servers with Apptainer version 1.1.2. This reason is that the new Apptainer stops binding current directory ($PWD) into the container. You will need to use the full command.
2.2.1 Run full command
#"-C": fully contained;
#"--bind $PWD:/data": $PWD is a Linux variable for current working directory. This option would bind $PWD as "/data" in container;
#"--pwd /data" : set "/data" as current working directory in container;
2.3 Pull a image from Dockerhub and convert it into a Singularity image .sif file
In this exercise, you will pull the latest rocker/r-rer image, and convert it into a singularity .sif file.
The Rocker container automatically starts the "R" command when the container starts. You would see the latest version of R starts.
2.3.1 Run short command
2.3.1 Run full command
#--bind: bind the current directory as the same path in the container.
#--pwd: set default working directory
Dockerfile is a script file that can be used to build an image.
2.1 Create a text file named "Dockerfile".
#make a new directory
#use your favorite text editor to create a text file with the following content, and name the file "Dockerfile".
#Dockerfile should be the only file in the directory, unless you want to copy other files into this image.
2.2. Use the "docker1 build" command to create a Docker image named "myapp2".
2.3. Run software in Docker