Hi Tims,
Assuming you are in $HOME ... you can do something like:
singularity shell --no-home ./myimage.sif
That will *not* bind your home directory in, but will bind in your
current working directory, so only that shows up in your $HOME
structure. What you have in your example should be the default
behavior. For example:
$ pwd && ls
/usr/local/singularity
2.5.2/ 2.6.1/ 3.0.1/ 3.1.0-rc4/ 3.1.0
$ ls ../bin/
hello.sh*
$ singularity shell -B $PWD ~/lolcow.sif
Singularity lolcow.sif:/usr/local/singularity> pwd && ls
/usr/local/singularity
2.5.2 2.6.1 3.0.1 3.1.0-rc4 3.1.0
Singularity lolcow.sif:/usr/local/singularity> ls ../bin/
Singularity lolcow.sif:/usr/local/singularity>
So in the above case, I changed to: /usr/local/singularity ... and I
used `-B $PWD` ... this bind mounted /usr/local/singularity into the
image at the same location. But, the host /usr/local/bin/ was not
included in this. Just the /usr/local/singularity directory and all
children.
Now, if you're wanting to cut off the entire directory structure,
you can use: `-B $PWD:/work_dir` (or similar). As Vanessa mentioned,
you can specify where you want a bind point to be mounted, otherwise
the default is just to mount it at the same path location. So, in this
example, $PWD would be mounted at `/work_dir` in the container,
instead of whatever path we actually have.
-J