# Running a program directly from a container in nextflow process

**URL:** <https://community.seqera.io/t/running-a-program-directly-from-a-container-in-nextflow-process/1186>\
**Category:** Ask for help\
**Tags:** nextflow\
**Created:** [September 12, 2024, 6:56pm UTC](https://community.seqera.io/t/running-a-program-directly-from-a-container-in-nextflow-process/1186 "2024-09-12T18:56:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amit\_Indap](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/amit_indap/32/1041_2.png) [@Amit\_Indap](https://community.seqera.io/u/Amit_Indap)\
**Post date:** [September 12, 2024, 6:56pm UTC](https://community.seqera.io/t/running-a-program-directly-from-a-container-in-nextflow-process/1186/1 "2024-09-12T18:56:47Z")

</div>

Hi,

I am trying to run this process in my nextflow workflow that runs deepvariant directly from a container:

```auto
process deepvariant {
    container 'quay.io/nf-core/deepvariant:1.5.0'
    publishDir "${params.output_dir}/deepvariant", mode: 'copy'

    input:
    tuple path(bam), path(bam_index)
    path reference
    path reference_index

    output:
    path "${bam.baseName}.vcf.gz", emit: vcf
    path "${bam.baseName}.vcf.gz.tbi", emit: vcf_tbi
    path "${bam.baseName}.g.vcf.gz", emit: gvcf
    path "${bam.baseName}.g.vcf.gz.tbi", emit: gvcf_tbi
    path "versions.yml", emit: versions

    script:
    """
    

    # Verify the contents of the container
    ls -l /opt/deepvariant/bin/

    # Run DeepVariant
    /opt/deepvariant/bin/run_deepvariant \\
        --model_type=WGS \\
        --ref=${reference} \\
        --reads=${bam} \\
        --output_vcf=${bam.baseName}.vcf.gz \\
        --output_gvcf=${bam.baseName}.g.vcf.gz \\
        --num_shards=${task.cpus} \\
        --intermediate_results_dir=.

    # Create versions.yml file
    cat <<-END_VERSIONS > versions.yml
    "${task.process}":
        deepvariant: \$(echo \$(/opt/deepvariant/bin/run_deepvariant --version 2>&1) | sed 's/^.*version //; s/ .*\$//' )
    END_VERSIONS
    """
}

```

However when I run this on my EC2 instance, I get an error

`ls: cannot access '/opt/deepvariant/bin/': No such file or directory`

Buy when I run the container interactively, it confirms I have the right path:

```auto
docker run -it quay.io/nf-core/deepvariant:1.5.0 ls -l /opt/deepvariant/bin/run_deepvariant

-rwxr-xr-x. 1 root root 68 Feb 26 2023 /opt/deepvariant/bin/run_deepvariant

```

Is there something I’m fundamentally missing? I would eventually want to run my workflow on AWS batch, but I’m testing out this process locally on EC2 to make sure it works there first.

---

<div class="post-metadata">

**Author:** ![Amit\_Indap](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/amit_indap/32/1041_2.png) [@Amit\_Indap](https://community.seqera.io/u/Amit_Indap)\
**Post date:** [September 12, 2024, 7:30pm UTC](https://community.seqera.io/t/running-a-program-directly-from-a-container-in-nextflow-process/1186/2 "2024-09-12T19:30:59Z")

</div>

I should have RTFM, when I added the following to my nextflow.config

```auto
docker.enabled = true

```

The error went away and the process is running.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/system/32/2402_2.png) [@system](https://community.seqera.io/u/system)\
**Post date:** [September 19, 2024, 7:31pm UTC](https://community.seqera.io/t/running-a-program-directly-from-a-container-in-nextflow-process/1186/3 "2024-09-19T19:31:48Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
