title: using ansible for provisioning docker containers
body: <p>Hi am using below docker file to build an image. Its running maven playbook perfectly But when started running sonar play book it gets hanged and nothing happens.Only dffrence in playbooks are that sonar playbook has restart statements.Can it a reason for the problem.I have tested each playbook and each one runs perfectly inside the container.
  Is ther any way to see container logs side by side as what all ansible is doing when building the image.As of now Docker spits logs only when its done with a step.</p>
  
  <pre><code>FROM xyz.com/akathaku/cidemo:latest
  
  MAINTAINER akathaku &lt;akathaku@gmail.com&gt;
  
  USER root
  
  
  ENV SCPATH /etc/supervisor/conf.d
  ENV PLAYBOOKS /ansible
  
  # RUN yum  -y update
  
  # The daemons
  RUN yum -y install supervisor
  RUN mkdir -p /var/log/supervisor
  
  # Supervisor Configuration
  ADD ./supervisord/conf.d/* $SCPATH/
  
  #Running ansible
  ADD ./sonar-playbook $PLAYBOOKS/sonar-playbook
  ADD ./maven-playbook $PLAYBOOKS/maven-playbook
  ADD ./jenkins-playbook $PLAYBOOKS/jenkins-playbook
  ADD ./tomcat-playbook $PLAYBOOKS/tomcat-playbook
  
  WORKDIR $PLAYBOOKS
  RUN ansible-playbook $PLAYBOOKS/sonar-playbook/sonar.yml -c local 
  RUN ansible-playbook $PLAYBOOKS/maven-playbook/maven.yml -c local
  RUN ansible-playbook $PLAYBOOKS/jenkins-playbook/jenkins.yml -c local
  RUN ansible-playbook $PLAYBOOKS/tomcat-playbook/tomcat.yml -c local
  
  
  # Application Code
  
  CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisor.conf"]
  EXPOSE 8080 8081 9000 9001 8086
  </code></pre>
  
  <p><strong>Below is the output of docker run</strong></p>
  
  <pre><code>Step 1 : FROM xyz.com/akathaku/cidemo:latest
   ---&gt; d477ceab5d3b
  Step 2 : MAINTAINER akathaku &lt;akathaku@gmail.com&gt;
   ---&gt; Using cache
   ---&gt; a9c3c191aabd
  Step 3 : USER root
   ---&gt; Using cache
   ---&gt; 24a18ddc6f49
  Step 4 : ENV SCPATH /etc/supervisor/conf.d
   ---&gt; Using cache
   ---&gt; ea6f4dada89c
  Step 5 : ENV PLAYBOOKS /ansible
   ---&gt; Using cache
   ---&gt; 9d42760dc51f
  Step 6 : RUN yum -y install supervisor
   ---&gt; Using cache
   ---&gt; 7af486ce2a8c
  Step 7 : RUN mkdir -p /var/log/supervisor
   ---&gt; Using cache
   ---&gt; a1b1c145d490
  Step 8 : ADD ./supervisord/conf.d/* $SCPATH/
   ---&gt; Using cache
   ---&gt; f16e32135351
  Step 9 : ADD ./sonar-playbook $PLAYBOOKS/sonar-playbook
   ---&gt; 170c1dc82ffa
  Removing intermediate container bfa474ef9d11
  Step 10 : ADD ./maven-playbook $PLAYBOOKS/maven-playbook
   ---&gt; 90a57735fe3b
  Removing intermediate container b5f7bbb3b85d
  Step 11 : ADD ./jenkins-playbook $PLAYBOOKS/jenkins-playbook
   ---&gt; 09ab0f929f45
  Removing intermediate container 7dc62423354d
  Step 12 : ADD ./tomcat-playbook $PLAYBOOKS/tomcat-playbook
   ---&gt; 13c3bb5f7aca
  Removing intermediate container 4356605f503a
  Step 13 : WORKDIR $PLAYBOOKS/maven-playbook
   ---&gt; Running in 34867677f4e1
   ---&gt; f48ffe4115db
  Removing intermediate container 34867677f4e1
  Step 14 : RUN ansible-playbook maven.yml -c local
   ---&gt; Running in 4eda53bf7e00
  
  PLAY [localhost] ************************************************************** 
  
  GATHERING FACTS *************************************************************** 
  ok: [localhost]
  
  TASK: [maven | Install Java 1.8 JRE] ****************************************** 
  changed: [localhost]
  
  TASK: [maven | Install Java 1.8 JDK] ****************************************** 
  changed: [localhost]
  
  TASK: [maven | lineinfile dest='/etc/profile' regexp='^#?\s*export JAVA_HOME=(.*)$' line='export JAVA_HOME=/usr/lib/jvm/java-openjdk' state=present] *** 
  changed: [localhost]
  
  TASK: [maven | lineinfile dest=/etc/profile regexp='^#?\s*export PATH=(.*)JAVA_HOME(.*)$' line="export PATH=$PATH:$JAVA_HOME/bin" state=present] *** 
  changed: [localhost]
  
  TASK: [maven | Reload profile] ************************************************ 
  changed: [localhost]
  
  TASK: [maven | Download Apache Maven] ***************************************** 
  changed: [localhost]
  
  TASK: [maven | Untar Maven to /opt] ******************************************* 
  changed: [localhost]
  
  TASK: [maven | Create symbolic link maven to the /opt/apache-{{ maven_version }}] *** 
  changed: [localhost]
  
  TASK: [maven | lineinfile dest=/etc/profile regexp='^#?\s*export MAVEN_HOME=(.*)$' line='export MAVEN_HOME=/opt/maven' state=present] *** 
  changed: [localhost]
  
  TASK: [maven | lineinfile dest=/etc/profile regexp='^#?\s*export PATH=(.*)MAVEN_HOME(.*)$' line="export PATH=$PATH:$MAVEN_HOME/bin" state=present] *** 
  changed: [localhost]
  
  TASK: [maven | Reload profile] ************************************************ 
  changed: [localhost]
  
  TASK: [maven | Create local repository] *************************************** 
  changed: [localhost]
  
  TASK: [maven | Creates setting.xml file] ************************************** 
  changed: [localhost]
  
  PLAY RECAP ******************************************************************** 
  localhost                  : ok=14   changed=13   unreachable=0    failed=0   
  
   ---&gt; fb211f3fbbfd
  Removing intermediate container 4eda53bf7e00
  Step 15 : WORKDIR $PLAYBOOKS/sonar-playbook
   ---&gt; Running in b9ba0623b48a
   ---&gt; d48ad5abbf43
  Removing intermediate container b9ba0623b48a
  Step 16 : RUN ansible-playbook sonar.yml -c local
   ---&gt; Running in 2d2716354c5d
  </code></pre>