title: How do I run a Bash script in an Alpine Docker container?
body: <p>I have a directory containing only two files, <code>Dockerfile</code> and <code>sayhello.sh</code>:</p>
  <pre><code>.
  ├── Dockerfile
  └── sayhello.sh
  </code></pre>
  <p>The <code>Dockerfile</code> reads</p>
  <pre><code>FROM alpine
  COPY sayhello.sh sayhello.sh
  CMD [&quot;sayhello.sh&quot;]
  </code></pre>
  <p>and <code>sayhello.sh</code> contains simply</p>
  <pre><code>echo hello
  </code></pre>
  <p>The <code>Dockerfile</code> builds successfully:</p>
  <pre><code>kurtpeek@Sophiemaries-MacBook-Pro ~/d/s/trybash&gt; docker build --tag trybash .
  Sending build context to Docker daemon 3.072 kB
  Step 1/3 : FROM alpine
   ---&gt; 665ffb03bfae
  Step 2/3 : COPY sayhello.sh sayhello.sh
   ---&gt; Using cache
   ---&gt; fe41f2497715
  Step 3/3 : CMD sayhello.sh
   ---&gt; Using cache
   ---&gt; dfcc26c78541
  Successfully built dfcc26c78541
  </code></pre>
  <p>However, if I try to <code>run</code> it I get an <code>executable file not found in $PATH</code> error:</p>
  <pre><code>kurtpeek@Sophiemaries-MacBook-Pro ~/d/s/trybash&gt; docker run trybash
  container_linux.go:247: starting container process caused &quot;exec: \&quot;sayhello.sh\&quot;: executable file not found in $PATH&quot;
  docker: Error response from daemon: oci runtime error: container_linux.go:247: starting container process caused &quot;exec: \&quot;sayhello.sh\&quot;: executable file not found in $PATH&quot;.
  ERRO[0001] error getting events from daemon: net/http: request canceled
  </code></pre>
  <p>What is causing this? I recall running scripts in <code>debian:jessie</code>-based images in a similar manner. So perhaps it is Alpine-specific?</p>