title: Running a bash script inside a Docker container
body: <p>How can I start a script after running a docker container.</p>
  
  <p>Here is a part of my Dockerfile:</p>
  
  <pre><code>FROM nodesource/trusty:0.10.30
  RUN mkdir /opt/app/ &amp;&amp; cd /opt/app/
  ADD ./api/package.json /opt/app/package.json
  RUN cd /opt/app/ &amp;&amp; npm install
  ADD ./api/src /opt/app/src
  RUN npm -g install pm2
  WORKDIR /opt/app/src
  ADD start.sh start.sh
  RUN chmod 755 /opt/app/src/start.sh
  CMD ./opt/app/src/start.sh
  </code></pre>
  
  <p>and start.sh contains:</p>
  
  <pre><code>#!/usr/bin/env bash
  cd /opt/app/src
  node app.js --env=dev:
  pm2 updatePM2
  pm2 startup
  pm2 save
  </code></pre>
  
  <p>PS: When I start the script after logging to the containerit works perfectly but not when calling it directly from Dockerfile</p>