title: docker entrypoint running bash script gets "permission denied"
body: <p>I'm trying to dockerize my node.js app. When the container is built I want it to run a <code>git clone</code> and then start the node server. Therefore I put these operations in a .sh script. And run the script as a single command in the ENTRYPOINT:</p>
  
  <pre><code>FROM ubuntu:14.04
  
  RUN apt-get update &amp;&amp; apt-get install -y build-essential libssl-dev gcc curl npm git
  
  #install gcc 4.9
  RUN apt-get install -y software-properties-common python-software-properties
  RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test
  RUN apt-get update
  RUN apt-get install -y libstdc++-4.9-dev
  
  #install newst nodejs
  RUN curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
  RUN apt-get install -y nodejs
  
  RUN mkdir -p /usr/src/app
  WORKDIR /usr/src/app
  
  ADD package.json /usr/src/app/
  RUN npm install
  
  ADD docker-entrypoint.sh /usr/src/app/
  
  EXPOSE 8080
  
  ENTRYPOINT ["/usr/src/app/docker-entrypoint.sh"] 
  </code></pre>
  
  <p>My docker-entrypoint.sh looks like this:</p>
  
  <pre><code>git clone git@&lt;repo&gt;.git
  git add remote upstream git@&lt;upstream_repo&gt;.git
  
  /usr/bin/node server.js
  </code></pre>
  
  <p>After building this image and run:</p>
  
  <pre><code>docker run --env NODE_ENV=development -p 8080:8080 -t -i &lt;image&gt;
  </code></pre>
  
  <p>I'm getting: </p>
  
  <pre><code>docker: Error response from daemon: oci runtime error: exec: "/usr/src/app/docker-entrypoint.sh": permission denied.
  </code></pre>
  
  <p>I shell into the container and the permission of docker-entrypoint.sh is:</p>
  
  <pre><code>-rw-r--r-- 1 root root 292 Aug 10 18:41 docker-entrypoint.sh
  </code></pre>
  
  <p>three questions:</p>
  
  <ol>
  <li><p>Does my bash script have wrong syntax?</p></li>
  <li><p>How do I change the permission of a bash file before adding it into an image?</p></li>
  <li><p>What's the best way to run multiple git commands in entrypoint without using a bash script?</p></li>
  </ol>
  
  <p>Thanks.</p>