title: How to execute script after container is just running
body: <p>I'm using a docker container of apache.
  I have to execute a script after the container is started. 
  How can I do this?</p>
  
  <p>First of all, I have a dockerfile:</p>
  
  <pre><code>FROM:ubunty:trusty
  ... necessary installs
  
  ADD test.sh /my-folder/    
  
  EXPOSE 80
  EXPOSE 443
  
  CMD ["/run.sh"]
  </code></pre>
  
  <p>In <code>run.sh</code> I'm executing as the last command: <code>exec apache2 -D FOREGROUND</code>, and this works.
  Now I want an additional script <code>test.sh</code> to be be executed after the container is started.</p>
  
  <p>In details, what I want is, after the apache container is started (this works), an additional script to be executed. That script has to connect to port 80 of my server (the port has been mapped at the run command).</p>
  
  <pre><code>CONTAINER ID        IMAGE                COMMAND             CREATED             STATUS              PORTS                                      NAMES
  61c66c17d5f1        my-apache            "/run.sh"           28 minutes ago      Up 28 minutes       0.0.0.0:80-&gt;80/tcp, 0.0.0.0:443-&gt;443/tcp   suspicious_shockley
  </code></pre>