# Help setting apptainer cache dir

**URL:** <https://community.seqera.io/t/help-setting-apptainer-cache-dir/762>\
**Category:** Ask for help\
**Tags:** apptainer, singularity\
**Created:** [May 16, 2024, 12:50am UTC](https://community.seqera.io/t/help-setting-apptainer-cache-dir/762 "2024-05-16T00:50:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ewissel](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/ewissel/32/710_2.png) [@ewissel](https://community.seqera.io/u/ewissel)\
**Post date:** [May 16, 2024, 12:50am UTC](https://community.seqera.io/t/help-setting-apptainer-cache-dir/762/1 "2024-05-16T00:50:49Z")

</div>

question on config variable setting~

I need to use nextflow v22.10.4 for a non-nf-core pipeline. I set my conda/singularity cache dirs in my config file, but am getting the following error indicating that apptainer is looking at the wrong directory (`/$HOME/$USER/` instead of specified dir which is on a different node called `/ceph/`)

```auto
FATAL: While making image from oci registry: error fetching image to cache: while building SIF from layers: while creating SIF: while unloading container: close /dicos_ui_home/ewissel/.apptainer/cache/oci-tmp/tmp_3980167945: disk quota exceeded

```

I tried to update the apptainer cache in my config file but must have done so unsuccessfully as I got the same error on a rerun. Can someone help me fix the apptainer cache directory? I used the singularity/conda cache dir commands as a template, so I don’t quite understand where I’m going wrong here.

```auto
## relevant partt of nextflow.config
profiles {
  standard {
    conda {
      useMamba = false
      conda.enabled = true
      // Allow longer conda creation timeout
      createTimeout = '2 h'
      cacheDir = "/ceph/work/IBMS-PHLab/emily/nf_conda/"
      }
      params.enable_conda = true
      singularity.enabled = false
      singularity.automounts = false
      docker.enabled = false
      podman.enabled = false
      shifter.enabled = false
      charliecloud.enabled = false
  }
  conda {
    conda {
    useMamba = false
    conda.enabled = true
    // Allow longer conda creation timeout
    createTimeout = '2 h'
    cacheDir = "/ceph/work/IBMS-PHLab/emily/nf_conda/"
    }
    params.enable_conda = true
    singularity.enabled = false
    singularity.automounts = false
    docker.enabled = false
    podman.enabled = false
    shifter.enabled = false
    charliecloud.enabled = false
  }
  singularity {
    singularity.enabled = true
    singularity.autoMounts = true
    singularity.runOptions = "--bind /ceph/sharedfs/work/IBMS-PHLab/emily/tmp:/tmp"
    singularity.cacheDir = "/ceph/work/IBMS-PHLab/emily/singularity-images/"
    params.enable_container=true
    docker.enabled = false
    podman.enabled = false
    shifter.enabled = false
    charliecloud.enabled = false
  }
  docker {
    singularity.enabled = false
    singularity.autoMounts = false
    docker.enabled = true
    params.enable_container=true
    podman.enabled = false
    shifter.enabled = false
    charliecloud.enabled = false
  }
  apptainer {
    apptainer.cacheDir = "/ceph/work/IBMS-PHLab/emily/singularity-images/" ## what I added
 }
}

```

When I run nextflow, i specify -profile singularity, so I’m not sure if the apptainer cache needs to be connected to the singularity profile in this instead of how it is now? Thanks for the help!

---

<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:** [May 20, 2024, 12:04am UTC](https://community.seqera.io/t/help-setting-apptainer-cache-dir/762/2 "2024-05-20T00:04:13Z")

</div>

Hey @ewissel.

What you’re actually doing is `apptainer.apptainer.cacheDir = "...`. You should do instead:

```auto
apptainer {
  cacheDir = "/ceph/work/IBMS-PHLab/emily/singularity-images/"
}

```

Or you can also set your cache directory for apptainer with an environment variable: `NXF_APPTAINER_CACHEDIR`.

Could you please try again and let me know if it worked?

---

<div class="post-metadata">

**Author:** ![ewissel](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/ewissel/32/710_2.png) [@ewissel](https://community.seqera.io/u/ewissel)\
**Post date:** [May 20, 2024, 12:32am UTC](https://community.seqera.io/t/help-setting-apptainer-cache-dir/762/3 "2024-05-20T00:32:20Z")

</div>

this worked, and is a big “duh” in hindsight. Thank you!!

---

<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:** [May 27, 2024, 12:32am UTC](https://community.seqera.io/t/help-setting-apptainer-cache-dir/762/4 "2024-05-27T00:32:59Z")

</div>

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