| title | description | date | tags | |||
|---|---|---|---|---|---|---|
Use cases |
Learn how to use Wave with Nextflow for container management, building, and security scanning |
2024-08-22 |
|
With Nextflow and Wave, you can build, upload, and manage the container images automatically and on demand during pipeline execution. The following sections describe several common use cases.
:::tip To get started with an example Nextflow pipeline that uses Wave, see Nextflow and Wave. :::
:::note Nextflow integration with Wave requires Nextflow 22.10.0 or later. :::
Use Wave to access private repositories for your Nextflow pipelines.
**Access private container repositories**
To enable private container repository access:
-
Add the following to your Nextflow configuration:
wave.enabled = true tower.accessToken = '<TOWER_ACCESS_TOKEN>'
Replace
<TOWER_ACCESS_TOKEN>with your Seqera access token. -
(Optional) If you created your credentials in an organization workspace, add your workspace ID to your Nextflow configuration:
tower.workspaceId = '<TOWER_WORKSPACE_ID>'
Replace
<TOWER_WORKSPACE_ID>with your Seqera workspace ID. -
Configure your repository access in Seqera. See Seqera Platform credentials for more information.
-
Add your build and build cache repository to your Nextflow configuration:
wave.build.repository = '<BUILD_REPOSITORY>' wave.build.cacheRepository = '<CACHE_REPOSITORY>'
Replace the following:
<BUILD_REPOSITORY>: the repository to store your built container images<CACHE_REPOSITORY>: the repository to store image layers for caching
Wave can build and provision container images on demand for your Nextflow pipelines.
**Build Nextflow module containers**
To enable Wave to build Nextflow module containers:
-
Add your Dockerfile to the module directory where you define the pipeline process.
-
Enable Wave in your Nextflow configuration:
wave.enabled = true
-
(Optional) Set your Wave strategy to prioritize Dockerfiles in your Nextflow configuration:
wave.strategy = ['dockerfile','container']
:::note The
containerdirective takes precedence over a Dockerfile by default. :::
:::warning
Wave does not support ADD, COPY, or other Dockerfile commands that access files in the host file system.
:::
Wave can provision containers based on the conda directive.
This allows you to use Conda packages in your pipeline, even on cloud-native platforms like AWS Batch and Kubernetes, which do not support the Conda package manager directly.
**Build Conda-based containers**
To enable Wave to provision Conda package containers:
-
Define your Conda packages using the
condadirective in your pipeline processes. -
Enable Wave in your Nextflow configuration:
wave.enabled = true
-
(Optional) Set your Wave strategy to prioritize
condain your Nextflow configuration:wave.strategy = ['conda']
:::note The
containerdirective or a Dockerfile takes precedence over thecondadirective by default. ::::::info Nextflow 23.10.0 or later automatically includes the
conda-forge::procps-ngpackage in provisioned containers. This package includes thepscommand. ::: -
Set your Conda channel priority:
conda.channels = '<CONDA_CHANNELS>'
Replace
<CONDA_CHANNELS>with a comma-separated list of your channel priorities.
Nextflow can build Singularity native images on demand using a Singularityfile or Conda packages.
Images are uploaded to an OCI-compliant container registry of your choice and stored as an ORAS artifact.
:::note
Requires Nextflow version 23.09.0-edge or later and a version of Singularity (or Apptainer) that supports pulling images using the oras: pseudo-protocol.
:::
**Build Singularity containers**
To enable provisioning of Singularity images:
-
Add the following to your Nextflow configuration:
wave.enabled = true wave.freeze = true wave.strategy = ['conda'] singularity.enabled = true
-
(Optional) To store your Singularity image files in a private registry:
-
Configure your repository access in Seqera. See Seqera Platform credentials for more information.
-
Add your build repository to your Nextflow configuration:
wave.build.repository = '<BUILD_REPOSITORY>'
Replace
<BUILD_REPOSITORY>with your OCI-compliant container registry.
-
-
Grant access to the repository on compute nodes:
singularity remote login <REMOTE_ENDPOINT>
Replace
<REMOTE_ENDPOINT>with your Singularity remote endpoint. See Singularity remote login for more information. -
(Optional) To build Singularity native images, disable both
singularity.ociAutoPullandsingularity.ociModein your Nextflow configuration. See Nextflow configuration for more information.
Wave enables mirroring by copying containers used by your pipeline to a container registry of your choice. Your pipeline can then pull containers from the target registry instead of the original registry.
**Mirror containers across registries**
To enable container mirroring:
-
Add the following to your Nextflow configuration:
wave.enabled = true wave.mirror = true tower.accessToken = '<TOWER_ACCESS_TOKEN>'
Replace
<TOWER_ACCESS_TOKEN>with your Seqera access token. -
Configure your private repository access in Seqera. See Seqera Platform credentials for more information.
-
Add your build repository to your Nextflow configuration:
wave.build.repository = '<BUILD_REPOSITORY>'
Replace
<BUILD_REPOSITORY>with your container registry.
Wave scans containers used in your Nextflow pipelines for security vulnerabilities. This feature helps you ensure that your pipelines use secure container images by identifying potential security risks before and during pipeline execution.
**Security scan containers**
To enable container security scanning:
-
Add the following to your Nextflow configuration:
```groovy wave.enabled = true wave.scan.mode = 'required' tower.accessToken = '<TOWER_ACCESS_TOKEN>' ```Replace
<TOWER_ACCESS_TOKEN>with your Seqera access token. -
Add the acceptable vulnerability levels to your Nextflow configuration:
wave.scan.allowedLevels = 'low,medium'
Accepted vulnerability levels include:
low,medium,high, andcritical.
:::note
When you set wave.scan.mode to required, Wave blocks pipeline execution if containers have vulnerabilities above the specified threshold.
The scanning uses the Common Vulnerabilities Scoring System (CVSS) to assess security risks.
:::
:::note Scan results expire after seven days. When a container is accessed after this period, Wave automatically re-scans it to ensure up-to-date security assessments. :::
Wave containers allow you to run your containerized pipelines with the Fusion file system. Wave with Fusion enables you to use an object storage bucket, such as AWS S3 or Google Cloud Storage, as your pipeline work directory.
**Use Wave with Fusion**
To enable Wave with Fusion, add the following to your Nextflow configuration:
```groovy
wave.enabled = true
fusion.enabled = true
tower.accessToken = '<TOWER_ACCESS_TOKEN>'
```
Replace `<TOWER_ACCESS_TOKEN>` with your [Seqera access token](../tutorials/nextflow-wave.mdx#create-your-seqera-access-token).
:::note For more information about Fusion capabilities and configuration options, see the Fusion file system documentation. :::
When using Wave with Fusion, your workflow's bin/ directory is automatically bundled into the container image. This differs from standard Nextflow behavior where bin scripts are staged separately to the work directory at runtime.
**How bin script bundling works**
With Fusion enabled:
- The
bin/directory contents are bundled into the container at/usr/local/bin/ - Changes to bin scripts trigger a container rebuild (the fingerprint includes file content hashes)
- Remote bin directory upload is disabled
Without Fusion (standard Wave):
- The
bin/directory is NOT bundled into the container by default - Scripts are uploaded separately to cloud storage at runtime
- Changes to bin scripts do NOT trigger a container rebuild
To explicitly enable bin bundling without Fusion:
wave.enabled = true
wave.bundleProjectResources = true:::warning
If you freeze an image with wave.freeze=true and later run with Wave disabled (wave.enabled=false), your pipeline will use the bin scripts that were baked into the frozen image at build time. Local changes to bin scripts will not be reflected. To pick up script changes, re-enable Wave to trigger a rebuild with the updated fingerprint.
:::