I run this command
apptainer exec myfile.sif ls -la /app
and it will correctly show all the files in the container. However, I try
apptainer exec myfile.sif ls -la ~
and it will show all the files in my home directory.
I’m confused. Why is that? Does the apptainer exec command automatically bind my home directory to the container?
>Solution :
Yes some directories, including $HOME are mounted automatically. See the documentation:
In the default configuration, the default bind mounts are:
- The user’s home directory (
$HOME)- The current working directory (
CWD), unless its path contains symlinks resolving to different locations on the host vs inside the
container./dev/etc/hosts/etc/localtime/proc/sys/tmp/var/tmp