2015-05-25 29 views
5

我不知道爲什麼,但我似乎無法弄清楚爲什麼會發生這種情況。我可以在本地構建並運行Docker鏡像。爲什麼我在docker/aws eb上獲得拒絕權限的錯誤?

近期事件:

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": [] 
} 

附加記錄作爲在連接:https://forums.aws.amazon.com/thread.jspa?threadID=181270

不限非常感謝幫助。


@nick-humrich試圖eb local run建議的工作。所以使用eb deploy結束了工作。

我以前一直通過網頁界面上傳。

最初使用eb deploy給我一個ERROR: TypeError :: data must be a byte string,但我發現這個issue已通過卸載pyopenssl解決。

所以我不知道爲什麼網絡界面給我權限被拒絕可能與壓縮文件有關?

但無論如何,我現在能夠部署謝謝你。

+1

你試過啓動它在本地'EB當地run'? –

+0

我不知道你可以做到這一點,所以這很酷,但是它是在本地使用'eb local run'工作..當我上傳它時仍然獲得權限:( – terrymunro

+0

什麼是bin/app?我假定它是一個可執行文件但是當你上傳的時候(作爲一個zip文件),它會丟失權限位什麼是你在本地使用的系統?怎麼運行它應該執行它的程序,例如:ENTRYPOINT [「/ bin/bash」,「 bin/app「]以防bash腳本。 – Samar

回答

1

我在Elastic Beanstalk上運行Docker時遇到了類似的問題。當我指出CMD在Dockerfile的shell腳本(/path/to/my_script.sh),在EB部署會失敗 /path/to/my_script.sh: Permission denied.

顯然,即使我已經泊塢窗期間運行RUN chmod +x /path/to/my_script.sh打造,由圖像運行,權限的時間已經改變了。最終,使它工作我就定居:

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

相關問題