Apptainer: Difference between revisions

Jump to navigation Jump to search
Bind-mount /home using an alternate destination directory
No edit summary
(Bind-mount /home using an alternate destination directory)
Line 216: Line 216:


   <!--T:57-->
   <!--T:57-->
apptainer shell -C -W $SLURM_TMPDIR -B /home -B /project -B /scratch your-container-name.sif
apptainer shell -C -W $SLURM_TMPDIR -B /home:/cluster_home -B /project -B /scratch your-container-name.sif


<!--T:58-->
<!--T:58-->
Line 310: Line 310:
<!--T:85-->
<!--T:85-->
i.e., <code>-B ./my_data_file.txt:/special/input.dat</code> bind mount maps the file <code>./my_data_file.txt</code> to be the file <code>/special/input.dat</code> inside the container and the <code>wc</code> command now processes that file. This feature can be useful when programs/scripts inside the container have hard-coded paths to files and directories that must be located in certain locations.
i.e., <code>-B ./my_data_file.txt:/special/input.dat</code> bind mount maps the file <code>./my_data_file.txt</code> to be the file <code>/special/input.dat</code> inside the container and the <code>wc</code> command now processes that file. This feature can be useful when programs/scripts inside the container have hard-coded paths to files and directories that must be located in certain locations.
If you need to bind-mount the <code>/home</code> filesystem in your container, use an alternate destination directory:
* <code>-B /home:/cluster_home</code>
This ensures that configuration files and programs in your home directory do not interfere with the software in your container. For example, programs in <code>$HOME/bin</code> and Python packages in <code>$HOME/.local/lib/python3.x</code> could be used instead of the corresponding files in your container in you used <code>-B /home</code>.


<!--T:86-->
<!--T:86-->
cc_staff
127

edits

Navigation menu