# Script to be run from the ansible module docker\_container

**URL:** <https://forum.ansible.com/t/script-to-be-run-from-the-ansible-module-docker-container/22994>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [November 10, 2016, 8:14am UTC](https://forum.ansible.com/t/script-to-be-run-from-the-ansible-module-docker-container/22994 "2016-11-10T08:14:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![MHM\_Reddy](https://avatars.discourse-cdn.com/v4/letter/m/96bed5/32.png) [@MHM\_Reddy](https://forum.ansible.com/u/MHM_Reddy)\
**Post date:** [November 10, 2016, 8:14am UTC](https://forum.ansible.com/t/script-to-be-run-from-the-ansible-module-docker-container/22994/1 "2016-11-10T08:14:15Z")

</div>

Hi All,

I am very new to ansible and trying to explore.  
I have requirement of launching docker container out of my box and execute series of scripts in the docker container.

- name: Execute xpcgen inside the container  
docker\_container:  
image: ubuntu-xpc  
name: XPCGEN  
volumes\_from: CREATE\_CONTAINER  
command: “{{ view\_path }}/{{ compile\_path }}/script.sh”  
state: started  
register: xpcgen
- debug: var=xpcgen

The above code is written in my ansible yml file and it suppose to create a docker container out of my customized docker image ubuntu-xpc and script “script.sh” to be run from the docker container.  
But the problem here is, the commands inside the script will be initiated and ansible will comeout without any errors.  
When i checked docker logs, the log will say, the process has started.  
But ansible is not waiting until the script finishes its job.  
Any help would be higly appreciable.

Thanks,  
MHM
