MuhsinFatih
MuhsinFatih

Reputation: 2221

Singularity container - Binding a folder in a seperate partition

I have a private group project folder (let's call it data_dir) on a high performance cluster where I don't have root privileges. The folder is in a seperate partition.
I have a singularity container where I need to access data_dir. Official documentation says -B flag is to bind path, but I can't access the folder within the container using -B. This is what I tried so far:

XXXXXX  login1[~/work/subcam] master ⦿ ➜  readlink data
/gpfs/projects/oceanvideo/data
XXXXXX  login1[~/work/subcam] master ⦿ ➜  singularity run -B $(readlink data):$(pwd)/data container.sif
WARNING: skipping mount of /local_scratch: no such file or directory

________                               _______________
___  __/__________________________________  ____/__  /________      __
__  /  _  _ \_  __ \_  ___/  __ \_  ___/_  /_   __  /_  __ \_ | /| / /
_  /   /  __/  / / /(__  )/ /_/ /  /   _  __/   _  / / /_/ /_ |/ |/ /
/_/    \___//_/ /_//____/ \____//_/    /_/      /_/  \____/____/|__/


You are running this container as user with ID 21530 and group 21500,
which should map to the ID and group for your user on the Docker host. Great!

tf-docker ~/work/subcam > cd data
bash: cd: data: No such file or directory
tf-docker ~/work/subcam > cd /gpfs/
tf-docker /gpfs > ls
work
tf-docker /gpfs > cd projects
bash: cd: projects: No such file or directory

How can I access data_dir with the container?

Upvotes: 1

Views: 2059

Answers (1)

tsnowlan
tsnowlan

Reputation: 3772

-B is the correct way to mount directories in the container. A few options:

  1. If /gpfs/projects/oceanvideo/data is itself a symlink, it will not resolve inside the container and give that error code. readlink will only resolve a single level. Find the original, non-linked path and use that with -B.
  2. If that is not the case, run with singularity -vv run ... to see if there is more information on why the directory is not being mounted.
  3. Make sure that the cluster allows user binds

Upvotes: 2

Related Questions