From 419b1b8c25d5bd66fba2d71a988d7c70595b4ff6 Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Thu, 16 Nov 2023 21:28:43 +0100 Subject: [PATCH] improve commands for building Apptainer image from Docker container --- mkdocs/docs/HPC/apptainer.md | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/mkdocs/docs/HPC/apptainer.md b/mkdocs/docs/HPC/apptainer.md index 6b255f0502d..f06d943b90a 100644 --- a/mkdocs/docs/HPC/apptainer.md +++ b/mkdocs/docs/HPC/apptainer.md @@ -55,13 +55,20 @@ Due to the nature of `--fakeroot` option, we recommend to write your Apptainer/Singularity image to a globally writable location, like `/tmp`, or `/local` directories. Once the image is created, you should move it to your desired destination. An example to make an -Apptainer/Singularity container: - -
$ APPTAINER_CACHEDIR=/tmp/ \
-APPTAINER_TMPDIR=/tmp/ \
-apptainer build --fakeroot /tmp/tensorflow-21.10-tf1-py3.sif \
-docker://nvcr.io/nvidia/tensorflow:21.10-tf1-py3
-
+Apptainer/Singularity container image: + +```shell +# avoid that Apptainer uses $HOME/.cache +export APPTAINER_CACHEDIR=/tmp/$USER/apptainer/cache +# instruct Apptainer to use temp dir on local filessytem +export APPTAINER_TMPDIR=/tmp/$USER/apptainer/tmpdir +# specified temp dir must exist, so create it +mkdir -p $APPTAINER_TMPDIR +# convert Docker container to Apptainer container image +apptainer build --fakeroot /tmp/$USER/tf.sif docker://nvcr.io/nvidia/tensorflow:21.10-tf1-py3 +# mv container image to $VSC_SCRATCH +mv /tmp/$USER/tf.sif $VSC_SCRATCH/tf.sif +``` ### Converting Docker images