A basic PlantIT workflow demonstrating the use of bind mounts.
By default Singularity (now Apptainer) only mounts the current working directory and a few other paths selected by system administrators. The rest of the container filesystem is readonly. Some workflows may need to write to different locations within the container, however. The --bind
option allows mapping additional paths in the container to writable locations on the host, e.g.
singularity shell --bind /data:/mnt docker://alpine
The above maps /data
on the host to /mnt
within the container, and files created in /mnt
will exist on the host after the container exits.
PlantIT supports bind mounts. To mount additional locations inside your container, provide one or more paths to the mount
attribute in your plantit.yaml
file. For instance:
...
mount:
- /data
- /logs
...
This will mount /data
and /logs
within the container to eponymously named subdirectories of the host working directory, in this case <task workdir>/data
and <task workdir>/logs
.
If you would like files written to mounted locations to be transferred back to CyVerse as workflow outputs, you have two options:
- Set your workflow's output path to a bind mount path relative to the task working directory
For instance:
...
mount:
- /data
output:
path: data
...
- Copy output files from mount points back to the task working directory from your workflow
The $WORKDIR
environment variable is available to your workflow's container runtime. Simply copy any nested output files back to the working directory and configure the output
section in plantit.yaml
appropriately to include desired names/patterns.