Skip to content

Computational-Plant-Science/plantit-example-bind-mounts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

PlantIT Example: Bind Mounts

A basic PlantIT workflow demonstrating the use of bind mounts.

What's a bind mount?

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.

Usage

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.

Outputs

If you would like files written to mounted locations to be transferred back to CyVerse as workflow outputs, you have two options:

  1. Set your workflow's output path to a bind mount path relative to the task working directory

For instance:

...
mount:
  - /data
output:
  path: data
...
  1. 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.

About

A simple workflow demonstrating bind mounts.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published