# Using ansible inside docker

**URL:** <https://forum.ansible.com/t/using-ansible-inside-docker/19791>\
**Category:** Ansible Project\
**Created:** [November 18, 2015, 11:48am UTC](https://forum.ansible.com/t/using-ansible-inside-docker/19791 "2015-11-18T11:48:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lewis](https://avatars.discourse-cdn.com/v4/letter/l/e9bcb4/32.png) [@lewis](https://forum.ansible.com/u/lewis)\
**Post date:** [November 18, 2015, 11:48am UTC](https://forum.ansible.com/t/using-ansible-inside-docker/19791/1 "2015-11-18T11:48:20Z")

</div>

Does anyone use ansible inside docker? We have for a while now, and we’ve had nothing but trouble with ansible’s service module and docker’s inability to run upstart.

Ansible 1.9 onwards seems to prefer using initctl over service, which in Docker is symlinked to /bin/true and so fails silently. Whereas service works fine, since it will default to sysv scripts if upstart isn’t available. Is there a specific reason that ansible prefers initctl?

Is it worth putting in a PR to detect this use-case specifically (initctl being symlinked to bin/true)? Or would a better fix be to let the user explicitly define a service module somehow?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [November 20, 2015, 8:07pm UTC](https://forum.ansible.com/t/using-ansible-inside-docker/19791/2 "2015-11-20T20:07:37Z")

</div>

check with 2.0, the service module had issues detecting the correct  
service system inside docker because of how docker setup things, we  
fixed several corner cases in the latest version of the service  
module.

it might have worked 'better' in older versions as detection failed in  
other ways even in non docker environments but in ways that worked for  
you.

if you still have issues please open a github ticket and provide the  
simplest reproducible case possible.
