title: "ELF: not found" and "syntax error: unexepected \"(\"" in Docker container
body: <p>I am trying to build a Docker image for <a href="https://github.com/schickling/beanstalkd-cli" rel="nofollow noreferrer"><code>beanstalkd-cli</code></a>. The image builds successfully, but when I run <code>docker run -it myimage</code>, it fails with:</p>
  
  <pre><code>/usr/local/bin/beanstalkd-cli: line 1: ELF: not found
  /usr/local/bin/beanstalkd-cli: line 2: syntax error: unexpected "("
  </code></pre>
  
  <p>Does this mean the build is bad? Or do I need to tweak <code>ENTRYPOINT</code> and/or <code>CMD</code>?</p>
  
  <p>Here is my Dockerfile:</p>
  
  <pre><code>FROM alpine:3.5
  
  LABEL maintainer="Coby Tamayo &lt;ctamayo@sitecrafting.com"
  
  # Install openssl, beanstalkd-cli
  RUN apk add --update openssl &amp;&amp; \
    wget https://github.com/schickling/beanstalkd-cli/releases/download/0.3.0/beanstalkd-cli-linux.tar.gz &amp;&amp; \
    tar -xvzf beanstalkd-cli-linux.tar.gz &amp;&amp; \
    chmod +x beanstalkd-cli &amp;&amp; \
    mv beanstalkd-cli /usr/local/bin/beanstalkd-cli &amp;&amp; \
    rm beanstalkd-cli-linux.tar.gz
  
  ENTRYPOINT ["/bin/sh"]
  CMD ["/usr/local/bin/beanstalkd-cli"]
  </code></pre>
  
  <h3>Update 1</h3>
  
  <p>When I remove the <code>ENTRYPOINT</code> and <code>CMD</code> completely, running the container drops me into a shell, where I can verify that beanstalkd-cli has execute permissions set:</p>
  
  <pre><code>$ docker run -it myimage
  / # which beanstalkd-cli
  /usr/local/bin/beanstalkd-cli
  / # ls -la /usr/local/bin/beanstalkd-cli
  -rwxrwxr-x    1 1000     1000       3020529 Feb 23  2015 /usr/local/bin/beanstalkd-cli
  </code></pre>
  
  <p>Just "for fun," I also tried setting only <code>ENTRYPOINT</code>, with no command, since I really don't care about running anything except <code>beanstalkd-cli</code> commands in this container:</p>
  
  <pre><code>ENTRYPOINT ["/usr/local/bin/beanstalkd-cli"]
  # no more CMD
  </code></pre>
  
  <p>When I <code>docker run</code> <em>this</em>, I get:</p>
  
  <pre><code>standard_init_linux.go:185: exec user process caused "no such file or directory"
  </code></pre>
  
  <p>Same result if I add the original <code>CMD</code> back in. Huh?</p>
  
  <h3>Update 2</h3>
  
  <pre><code># file /usr/local/bin/beanstalkd-cli
  /usr/local/bin/beanstalkd-cli: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.24, BuildID[sha1]=63a19b18574643c1da5bafd5bd56fc26af22ab05, not stripped
  
  # uname -a
  Linux 6882ec36481d 4.10.0-40-generic #44~16.04.1-Ubuntu SMP Thu Nov 9 15:37:44 UTC 2017 x86_64 Linux
  
  # /usr/local/bin/beanstalkd-cli
  /bin/sh: /usr/local/bin/beanstalkd-cli: not found
  </code></pre>