Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why am I getting a permission denied error on docker/aws eb?

I don't know why but I cannot seem to figure out why this is happening. I can build and run the docker image locally.

Recent Events:

2015-05-25 12:57:07 UTC+1000    ERROR   Update environment operation is complete, but with errors. For more information, see troubleshooting documentation.
2015-05-25 12:57:07 UTC+1000    INFO    New application version was deployed to running EC2 instances.
2015-05-25 12:57:04 UTC+1000    INFO    Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
2015-05-25 12:57:04 UTC+1000    ERROR   [Instance: i-4775ec9b] Command failed on instance. Return code: 1 Output: (TRUNCATED)... run Docker container: vel="fatal" msg="Error response from daemon: Cannot start container 02c057b331bf3a3d912bf064f1dca3e00c95746b5748c3c4a28a5c6b452ff335: [8] System error: exec: \"bin/app\": permission denied" . Check snapshot logs for details. Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/04run.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
2015-05-25 12:57:03 UTC+1000    ERROR   Failed to run Docker container: vel="fatal" msg="Error response from daemon: Cannot start container 02c057b331bf3a3d912bf064f1dca3e00c95746b5748c3c4a28a5c6b452ff335: [8] System error: exec: \"bin/app\": permission denied" . Check snapshot logs for details.

Dockerfile:

FROM java:8u45-jre
MAINTAINER Terence Munro <[email protected]>
ADD ["opt", "/opt"]
WORKDIR /opt/docker
RUN ["chown", "-R", "daemon:daemon", "."]
USER daemon
ENTRYPOINT ["bin/app"]
EXPOSE 9000

Dockerrun.aws.json:

{
  "AWSEBDockerrunVersion": "1",
  "Ports": [
    {
      "ContainerPort": "9000"
    }
  ],
  "Volumes": []
}

Additional logs as attachment at: https://forums.aws.amazon.com/thread.jspa?threadID=181270

Any help is extremely appreciated.


@nick-humrich suggestion of trying eb local run worked. So using eb deploy ended up working.

I had previously been uploading through the web interface.

Initially using eb deploy was giving me a ERROR: TypeError :: data must be a byte string but I found this issue which was resolved by uninstalling pyopenssl.

So I don't know why the web interface was giving me permission denied perhaps something to do with the zip file?

But anyway I'm able to deploy now thank you.

like image 946
terrymunro Avatar asked Sep 27 '22 20:09

terrymunro


1 Answers

I had a similar problem running Docker on Elastic Beanstalk. When I pointed CMD in the Dockerfile to a shell script (/path/to/my_script.sh), the EB deployment would fail with /path/to/my_script.sh: Permission denied.

Apparently, even though I had run RUN chmod +x /path/to/my_script.sh during the Docker build, by the time the image was run, the permissions had been changed. Eventually, to make it work I settled on:

CMD ["/bin/bash","-c","chmod +x /path/to/my_script.sh && /path/to/my_script.sh"]

like image 59
SMX Avatar answered Oct 24 '22 21:10

SMX