Confusion over why a tool works in Docker but fails in Singularity when the installation doesn't differ, i.e. using wave ( micromamba )

I used the Seqera Containers interface to make a docker container. The main tool inside works if I use docker

(base) root@baab53dc3cbf:/workspace/Nextflow_sandbox# quarto check
Quarto 1.5.57
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.2.0: OK
      Dart Sass version 1.58.3: OK
      Deno version 1.41.0: OK
      Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.5.57
      Path: /opt/conda/bin

[✓] Checking tools....................OK
      TinyTeX: (not installed)
      Chromium: (not installed)

[✓] Checking LaTeX....................OK
      Tex:  (not detected)

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.12.6 (Conda)
      Path: /opt/conda/bin/python
      Jupyter: 5.7.2
      Kernels: python3

[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........(None)

      Unable to locate an installed version of R.
      Install R from https://cloud.r-project.org/


However if I convert this to image to Singularity and use it, quarto check fails to find a dependency.

Singularity> quarto check
/opt/conda/bin/quarto: line 191: /opt/conda/bin/tools/x86_64/deno: No such file or directory

Even if I build the image for singularity directly for singularity, I have the same issue. quarto check fails to find the dependency.

Why would the same installation method result in two different behaviours? The env settings are different between docker and singularity. There are environment variables related to DENO in the docker image, but not in the singularity image, and it’s stumping me as to why this would be the case.

Repo with minimal reproducible example: GitHub - mahesh-panchal/quarto-docker-singularity-problem

I think I’ve found a rough explanation:

Within a docker container this isn’t an issue, but when using a apptainer container it doesn’t carry out the usual activation of the conda environment and the ./conda/etc/conda/activate.d/quarto.sh file is never run, thus the QUARTO_* variables aren’t set correctly which results in a /opt/conda/bin/quarto: line 176: /opt/conda/bin/tools/x86_64/deno: No such file or directory error. By manually setting the variables contained in ./conda/etc/conda/activate.d/quarto.sh within the Dockerfile it seems to circumvent this issue, and I believe should be using the correct version of deno.

It doesn’t quite explain everything, but does at least provide a solution.
Adding in the shell script

    # Fix Quarto for apptainer
    ENV_QUARTO=/opt/conda/etc/conda/activate.d/quarto.sh
    set +u
    if [ -z "\${QUARTO_DENO}" ] && [ -f "\${ENV_QUARTO}" ]; then
        source "\${ENV_QUARTO}"
    fi
    set -u

will source the correct variables and let it work.

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