tschaffter/rstudio

Support running notebooks that rely on .env via CLI

tschaffter opened this issue · 1 comments

The content of the configuration file .env is handled when starting the container using docker-compose. However the content of .env is never used when running the container using docker run, for example when rendering notebooks using docker run.

The current use case is to generate the notebook synapse.Rmd that requires access to the Synapse Config file generated at start based on SYNAPSE_TOKEN. As a result, the following command fails:

$ docker run --rm \
>     -v $(pwd)/notebooks:/data \
>     -e RENDER_INPUT="/data/examples/synapse.Rmd" \
>     tschaffter/rstudio \
>     render
Quitting from lines 41-50 (synapse.Rmd)
Error in py_call_impl(callable, dots$args, dots$keywords) :
  SynapseNoCredentialsError: No credentials provided.

Detailed traceback:
  File "/opt/miniconda/envs/sage-bionetworks/lib/python3.9/site-packages/synapseclient/client.py", line 420, in login
    raise SynapseNoCredentialsError("No credentials provided.")
Calls: <Anonymous> ... withVisible -> eval -> eval -> <Anonymous> -> py_call_impl
Execution halted

The image rocker/rstudio uses s6 init system. In this context, the CMD of the official image is /init.

$ docker inspect tschaffter/rstudio | grep -C 2 "Cmd"
            "StdinOnce": false,
            "Env": null,
            "Cmd": null,
            "Image": "",
            "Volumes": null,
--
                "miniconda_bin_dir=/opt/miniconda/bin"
            ],
            "Cmd": [
                "/init"
            ],