Using a local Dockerfile based on renv.lock

Hi everyone,

in order to use and share an R script with CWL, I am trying to create and reference a Dockerfile based on the R package renv; mostly following the renv + docker instructions: (Using renv with Docker • renv and Docker – Solutions).

Does anyone have experience with that combination?

My Dockerfile looks like this:

## Use pre-built base image coming with R and required system libraries
FROM rstudio/r-base:4.3-jammy

## Install package `renv` to Docker image
RUN R -e "install.packages('renv', repos = c(CRAN = 'https://cloud.r-project.org'))"

## Pull in renv.lock and restore it
COPY *renv.lock ./
RUN R -e "renv::restore()"

The Dockerfile works fine with docker build ... .

However, when using it in my CommandLineTool, it throws an error, which I assume comes from renv.lock not being properly copied / found:

Workflow or tool uses unsupported feature:
Docker is required to run this tool: Command …

My CWL:

#!/usr/bin/env cwl-runner
cwlVersion: v1.2
class: CommandLineTool

requirements:
    ShellCommandRequirement: {}
    InitialWorkDirRequirement:
      listing:
        - entryname: renv.lock
          entry:
            $include: "./renv.lock"
    DockerRequirement:
        dockerFile: {$include: "./Dockerfile"}
        dockerImageId: "renv-docker-test"

...

I must admit I also don’t have much experience with Docker, so my apologies if that’s a trivial issue.

Or can somebody point me to an easier / better alternative resource to handling R dependencies with CWL?

Thanks!

Hello @Brilator
In CWL, when you use the dockerFile feature, you can’t use COPY commands.

Can you open an issue with cwltool so we have a better error message?