title: Executing a shell script within docker with RUN command
body: <p>New to dockers, so please bear with me.</p>
  
  <p>My Dockerfile contains an ENTRYPOINT:</p>
  
  <pre><code>ENV MONGOD_START "mongod --fork --logpath /var/log/mongodb.log --logappend --smallfiles"
  ENTRYPOINT ["/bin/sh", "-c", "$MONGOD_START"]
  </code></pre>
  
  <p>I have a shell script add an entry to database through python script, and starts the server.</p>
  
  <p>The script <strong>startApp.sh</strong></p>
  
  <pre><code>chmod +x /addAddress.py
  python /addAddress.py $1
  cd /myapp/webapp 
  grunt serve --force
  </code></pre>
  
  <p>Now, all the below RUN commands are unsuccessful in executing this script.</p>
  
  <pre><code>sudo docker run -it --privileged myApp -C /bin/bash &amp;&amp; /myApp/webapp/startApp.sh loc
  
  sudo docker run -it --privileged myApp /myApp/webapp/startApp.sh loc
  </code></pre>
  
  <p>The docker log of container is </p>
  
  <pre><code>"about to fork child process, waiting until server is ready for connections. forked process: 7 child process started successfully, parent exiting "
  </code></pre>
  
  <p>Also, the startApp.sh executes fine when I open a bash prompt in docker and run it.</p>
  
  <p>I am unable to figure out what wrong I am doing, help please.</p>