# Issues running available singularity container with Nextflow

**URL:** <https://community.seqera.io/t/issues-running-available-singularity-container-with-nextflow/648>\
**Category:** Ask for help\
**Tags:** singularity\
**Created:** [April 8, 2024, 10:51am UTC](https://community.seqera.io/t/issues-running-available-singularity-container-with-nextflow/648 "2024-04-08T10:51:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![JAlvarez](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/jalvarez/32/605_2.png) [@JAlvarez](https://community.seqera.io/u/JAlvarez)\
**Post date:** [April 8, 2024, 10:51am UTC](https://community.seqera.io/t/issues-running-available-singularity-container-with-nextflow/648/1 "2024-04-08T10:51:51Z")

</div>

Hi, I’m trying to add Nextflow to our GitLab CI/CD system and I’ve been trying to use Nextflow 23.10.1 from [Docker](https://hub.docker.com/r/nextflow/nextflow/tags) unsuccessfully because when you call `nextflow` the following error is raised:

Error: Unable to access jarfile /.nextflow/framework/23.10.1/nextflow-23.10.1-one.jar Unable to initialize nextflow environment

It gives me the feeling these containers are not set up properly, but I must confess I’m not certain. So any help would be much appreciated.

---

<div class="post-metadata">

**Author:** ![mribeirodantas](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/mribeirodantas/32/235_2.png) [@mribeirodantas](https://community.seqera.io/u/mribeirodantas)\
**Post date:** [April 8, 2024, 11:59am UTC](https://community.seqera.io/t/issues-running-available-singularity-container-with-nextflow/648/2 "2024-04-08T11:59:58Z")

</div>

Welcome to the forum, @JAlvarez. Can you provide more details about how you’re running Nextflow in your GitLab CI/CD system? Also, have you tried a different version?

---

<div class="post-metadata">

**Author:** ![JAlvarez](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/jalvarez/32/605_2.png) [@JAlvarez](https://community.seqera.io/u/JAlvarez)\
**Post date:** [April 8, 2024, 12:30pm UTC](https://community.seqera.io/t/issues-running-available-singularity-container-with-nextflow/648/3 "2024-04-08T12:30:29Z")

</div>

Thank you @mribeirodantas ! I have tried to just do `nextflow -version` in the container from Docker and I was getting the exception above, even from my local machine (so no complicated GitLab CI/CD runners or anything like that, just a simple Ubuntu with Singularity CE).

The exact list of commands:

```auto
singularity pull nextflow.sif docker://nextflow/nextflow:23.10.1
singularity shell nextflow.sif
nextflow -version

```

---

<div class="post-metadata">

**Author:** ![mribeirodantas](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/mribeirodantas/32/235_2.png) [@mribeirodantas](https://community.seqera.io/u/mribeirodantas)\
**Post date:** [April 8, 2024, 2:13pm UTC](https://community.seqera.io/t/issues-running-available-singularity-container-with-nextflow/648/4 "2024-04-08T14:13:29Z")

</div>

Then I believe this is a version issue, because I did the following with `nextflow:latest` and it worked.

```auto
docker pull nextflow/nextflow:latest
docker run -ti nextflow/nextflow bash
nextflow run hello

```

Check the output:

 ![CleanShot 2024-04-08 at 11.13.07@2x](https://europe1.discourse-cdn.com/flex013/uploads/seqera/original/1X/b2a0879f030ac1a214d8879f78b60999e8a32382.jpeg)

Do you really need Nextflow `23.10.1`?

**UPDATE**  
I also tested `23.10.1` and it worked here 🤯

 ![CleanShot 2024-04-08 at 11.15.18@2x](https://europe1.discourse-cdn.com/flex013/uploads/seqera/original/1X/19a165a35c5906e3e371548d6888ca9119074f3b.jpeg)

---

<div class="post-metadata">

**Author:** ![JAlvarez](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/jalvarez/32/605_2.png) [@JAlvarez](https://community.seqera.io/u/JAlvarez)\
**Post date:** [April 8, 2024, 2:24pm UTC](https://community.seqera.io/t/issues-running-available-singularity-container-with-nextflow/648/5 "2024-04-08T14:24:04Z")

</div>

It may be because you are using Docker? With Singularity the following happens:

```auto
$ singularity run docker://nextflow/nextflow:latest nextflow run hello
INFO: Converting OCI blobs to SIF format
INFO: Starting build...
INFO: Creating SIF file...
Error: Unable to access jarfile /.nextflow/framework/24.02.0-edge/nextflow-24.02.0-edge-one.jar
Unable to initialize nextflow environment

```

Based on my understanding, the problem is that the `jar` file is created by `root` user with no `group` or `other` reading permission (see below), and whilst Docker uses `root` as the default user, Singularity does not (main reason why it is the preferred technology in our cluster).

```auto
Singularity> ls -l /.nextflow/framework/24.02.0-edge/nextflow-24.02.0-edge-one.jar 
-rw------- 1 root root 1706444 Mar 10 20:21 /.nextflow/framework/24.02.0-edge/nextflow-24.02.0-edge-one.jar

```

---

<div class="post-metadata">

**Author:** ![jordeu](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/jordeu/32/90_2.png) [@jordeu](https://community.seqera.io/u/jordeu)\
**Post date:** [April 8, 2024, 4:28pm UTC](https://community.seqera.io/t/issues-running-available-singularity-container-with-nextflow/648/6 "2024-04-08T16:28:40Z")

</div>

Using the default generated singularity image, there are two problems. One is that the `NXF_HOME` is at `/.nextflow` and is owned by the root, and the other is that it’s a read-only filesystem. You could solve the root problem by running singularity with `--fake-root`, but you will still hit the problem of a read-only filesystem.

One workaround is to change the `NXF_HOME` to a writable folder.

```auto
$ singularity run --env NXF_HOME=$(pwd)/.nf-singularity docker://nextflow/nextflow:latest nextflow run hello
INFO: Using cached SIF image

 N E X T F L O W ~ version 24.02.0-edge

 ┃ Launching `https://github.com/nextflow-io/hello` [boring_sinoussi] DSL2 - revision: 7588c46ffe [master]

executor > local (4)
[9c/f086b8] process > sayHello (2) [100%] 4 of 4 ✔
Hello world!

Hola world!

Bonjour world!

Ciao world!

```

This will work, but you will always download all the Nextflow jar dependencies each time if that folder does not persist.

---

<div class="post-metadata">

**Author:** ![JAlvarez](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/jalvarez/32/605_2.png) [@JAlvarez](https://community.seqera.io/u/JAlvarez)\
**Post date:** [April 8, 2024, 4:53pm UTC](https://community.seqera.io/t/issues-running-available-singularity-container-with-nextflow/648/7 "2024-04-08T16:53:04Z")

</div>

That is doable in our current infrastructure. Thank you very much!
