# Running docker from a CommandLineTool

**URL:** <https://cwl.discourse.group/t/running-docker-from-a-commandlinetool/836>\
**Category:** CWL Questions\
**Created:** [October 10, 2023, 9:06am UTC](https://cwl.discourse.group/t/running-docker-from-a-commandlinetool/836 "2023-10-10T09:06:12Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![alexiswl](https://yyz2.discourse-cdn.com/free1/user_avatar/cwl.discourse.group/alexiswl/32/93_2.png) [@alexiswl](https://cwl.discourse.group/u/alexiswl)\
**Post date:** [October 10, 2023, 10:53pm UTC](https://cwl.discourse.group/t/running-docker-from-a-commandlinetool/836/2 "2023-10-10T22:53:19Z")

</div>

Hi Locos,

This probably could have been a comment on the [question you linked](https://cwl.discourse.group/t/forming-multiple-arguments-via-arguments/297).

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

```plaintext
requirements:
  DockerRequirement:
    dockerpull: image1:v1

```

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

```auto
baseCommand: ["bash", "myscript.sh"]

```

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.

---

_[View the full topic](https://cwl.discourse.group/t/running-docker-from-a-commandlinetool/836)._
