Running docker from a CommandLineTool

I have the same problem, the code below doesn’t work:

baseCommand: [docker, run, -v, /data:/data, --user, $(id -u):$(id -g), image1:v1]

Hi Locos,

This probably could have been a comment on the question you linked.

Regardless, in order for someone to assist you, please provide a fully reproducible example (not just the base command attribute) along with any errors that you’re seeing along with what you’re expecting to run?

Speculating with the limited code above, I think you ought to put the docker components in the DockerRequirement section of your CWL CommandLineTool, i.e

    dockerpull: image1:v1

The baseCommand section should then represent the script inside the docker container you are wanting to run. i.e

baseCommand: [ "bash", "" ]

cwltool will handle the -v/--volume parameters based off your inputs and most implementations will assign a rootless random uid for the -u/--user parameter.

1 Like

[Note: Locos’s question was originally a comment, but I moved their post to its own topic and added the link, so it could have its own answer and since so much time had passed since the original topic was answered. Thank you @alexiswl , as always, for helping out here!]

1 Like