On Ubuntu 24:

```bash
mkdir my_folder/
touch my_folder/my_file
mkdir jail/
cd jail/
apptainer run --mount type=bind,src=$HOME/my_folder/,dst=$PWD/my_folder/ ~/my_debian.sif ls
```

does not return anything (not `my_folder/`), why?
May 21, 4:00pm

The issue is that $PWD in the mount destination is evaluated on the host, but the destination path must be valid inside the container.

In your case:

  • dst=$PWD/my_folder/ → Host expands $PWD to /home/user/jail/, so destination = /home/user/jail/my_folder/ inside the container
  • But your Debian container likely does not have /home/user/jail/ in its filesystem
  • The container's working directory falls back to / (or another default), so ls lists a directory that does not contain your mount point

Fix

Use a relative path for the destination so it lands in the container's current working directory:

bash
apptainer run --mount type=bind,src=$HOME/my_folder/,dst=my_folder/ ~/my_debian.sif ls

Now my_folder/ will appear in the container's working directory, and ls will show it.

May 21, 4:00pm

This is a shared conversation and may include unverified content that doesn't reflect Mistral AI's views. Login to resume chatting.

Vibe can make mistakes. Check answers. Learn more