Why I receive permission denied in Docker deployment?

后端 未结 2 1195
生来不讨喜
生来不讨喜 2021-01-27 05:36

I have created an application in Elastic Beanstalk to host a play framework 2 app there using instructions from this project.

I have packaged the project exactly like Do

相关标签:
2条回答
  • 2021-01-27 05:49

    Here's what I did to solve this same issue, though I'm not sure which part specifically solved it.

    My DockerFile looks like:

    FROM dockerfile/java
    MAINTAINER yourNameHere
    EXPOSE 9000 9443
    ADD files /
    WORKDIR /opt/docker
    RUN ["chown", "-R", "daemon", "."]
    # Make sure myApp is excutable
    RUN ["chmod", "+x", "bin/myApp"]
    USER daemon
    # If running a t1.micro or other memory limited instance
    # be sure to limit play memory. This assumes play 2.3.x
    ENTRYPOINT ["bin/myApp", "-mem", "512", "-J-server"]
    CMD []
    

    See https://www.playframework.com/documentation/2.3.x/ProductionConfiguration for info on setting jvm memory.

    My Dockerrun.aws.json (also required) looks like:

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

    Finally my play application lives in files/opt/docker with the run script in docker/bin. All this is zipped up and sent to EB.

    0 讨论(0)
  • 2021-01-27 06:00

    Add a chmod command to make your file executable:

    RUN ["chmod", "+x", "bin/myApp"]
    

    So your Dockerfile will be:

    FROM dockerfile/java
    MAINTAINER Cristi Boariu <myemail>
    EXPOSE 9000
    ADD files /
    WORKDIR /opt/docker
    RUN ["chown", "-R", "daemon", "."]
    USER daemon
    RUN ["chmod", "+x", "bin/myApp"]
    
    ENTRYPOINT ["bin/mytweetalerts"]
    CMD []
    
    0 讨论(0)
提交回复
热议问题