title: docker and elastic beanstalk container stopped unexpectedly and permission denied
body: <p>I am trying to extend <a href="https://github.com/Ir1sh/dockeractivator" rel="nofollow">this docker image</a> which is provisioned with ansible and build successfully on <a href="https://registry.hub.docker.com/u/ir1sh/dockeractivator/" rel="nofollow">docker hub</a> at least, part of this image includes a user called play which owns a directory called /home/play/Code that has 755 permissions.  I am using boot2docker on mac</p>
  
  <p>This is my docker file locally</p>
  
  <pre><code>FROM ir1sh/dockeractivator
  MAINTAINER Mark Moore
  EXPOSE 9000
  </code></pre>
  
  <p>which builds ok and when I run</p>
  
  <pre><code>docker run --rm -it -v "/my/local/dir:/home/play/Code" -p 9000:9000 300b01a6199c
  </code></pre>
  
  <p>the container starts correctly and I get a session with user root starting in /home/play/Code.  If I add -u play to that commade I get a session with the play user instead in the same directory.</p>
  
  <p>Now if I push that container to elastic beanstalk with their cli tool I get the following error</p>
  
  <blockquote>
    <p>Output: [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/04run.sh]
    command failed with error code 1:
    /opt/elasticbeanstalk/hooks/appdeploy/pre/04run.sh
    b07ae15d619ad90441f6f410a31a7d51885151c92cd8675c5d8e47f63b43dd95
    Docker container quit unexpectedly after launch: Docker container quit
    unexpectedly on Sun Dec 21 13:36:06 UTC 2014:. Check snapshot logs for
    details..</p>
  </blockquote>
  
  <p>The logs aren't very enlightening</p>
  
  <p>Now per another suggestion I dont have a CMD or an ENTRYPOINT in my docker file so I add those.</p>
  
  <pre><code>FROM ir1sh/dockeractivator
  MAINTAINER Mark Moore
  EXPOSE 9000
  ENTRYPOINT ["/home/play/Code", "-DFOREGROUND"]
  CMD []
  </code></pre>
  
  <p>The image builds but now when I try docker run with the same options as above I get </p>
  
  <blockquote>
    <p>exec: "/home/play/Code": permission denied2014/12/21 13:34:33 Error
    response from daemon: Cannot start container
    2703462a68a32e8d774e9b4d8cbc3c809e79f53bb1d08f0398b45436d07546a3:
    exec: "/home/play/Code": permission denied</p>
  </blockquote>
  
  <p>This happens whether I try to start the session as root or as play.  I get the same error if I push this dockerfile to elastic beanstalk so its not related to boot2docker  Any idea what my permission problem is here?  I have tried changing that directories permission to 777 to no avail</p>
  
  <p>edit1: running as privileged also does not help</p>
  
  <p>edit2: changing the dockerfile to </p>
  
  <pre><code>FROM ir1sh/dockeractivator
  MAINTAINER Mark Moore
  EXPOSE 9000
  CMD ["bash"]
  </code></pre>
  
  <p>Allows me to run the container locally but afterpushing to elastic beanstalk I get the container quit unexpectedly error again</p>