# Docker module for \`docker-compose run\`?

**URL:** <https://forum.ansible.com/t/docker-module-for-docker-compose-run/26591>\
**Category:** Ansible Project\
**Created:** [January 29, 2018, 8:28pm UTC](https://forum.ansible.com/t/docker-module-for-docker-compose-run/26591 "2018-01-29T20:28:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brandon\_Schlueter](https://avatars.discourse-cdn.com/v4/letter/b/d26b3c/32.png) [@Brandon\_Schlueter](https://forum.ansible.com/u/Brandon_Schlueter)\
**Post date:** [January 29, 2018, 8:28pm UTC](https://forum.ansible.com/t/docker-module-for-docker-compose-run/26591/1 "2018-01-29T20:28:56Z")

</div>

In writing a playbook to bring up sentry according to its docs with docker-compose, I ended up with a task list including:

| |
| | 
- name: run database migrations

 |
| | 

command:

 |
| | 

docker-compose run --rm web upgrade --noinput

 |
| | 

chdir=/opt/sentry-onpremise

 |
| | |
| | 
- name: create initial user

 |
| | 

command:

 |
| | 

docker-compose run --rm web createuser

 |
| | 

–email [nobody@example.com](mailto:nobody@example.com)

 |
| | 

–password supersecretpassword

 |
| | 

–superuser

 |
| | 

chdir=/opt/sentry-onpremise

 |
| | |
| | 
- name: start docker service

 |
| | 

docker\_service:

 |
| | 

project\_src: /opt/sentry-onpremise

 |
| | 

state: present

 |

Is there docker module I could be using instead of the command module calls to `docker-compose run`?

For reference, the docker compose file I’m using is at [https://github.com/refinery29/sentry-onpremise/blob/master/docker-compose.yml](https://github.com/refinery29/sentry-onpremise/blob/master/docker-compose.yml) (forked from the original).

---

<div class="post-metadata">

**Author:** ![Andrew\_Latham](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@Andrew\_Latham](https://forum.ansible.com/u/Andrew_Latham)\
**Post date:** [January 29, 2018, 8:32pm UTC](https://forum.ansible.com/t/docker-module-for-docker-compose-run/26591/2 "2018-01-29T20:32:46Z")

</div>

[http://docs.ansible.com/ansible/latest/docker\_service\_module.html](http://docs.ansible.com/ansible/latest/docker_service_module.html)

---

<div class="post-metadata">

**Author:** ![Brandon\_Schlueter](https://avatars.discourse-cdn.com/v4/letter/b/d26b3c/32.png) [@Brandon\_Schlueter](https://forum.ansible.com/u/Brandon_Schlueter)\
**Post date:** [January 29, 2018, 9:27pm UTC](https://forum.ansible.com/t/docker-module-for-docker-compose-run/26591/3 "2018-01-29T21:27:11Z")

</div>

I’m aware of that module and am using it in that task list where I would run `docker-compose up`, but I’m not seeing how to use that module for `docker-compose run`, could you elaborate?
