【问题标题】:Dockerrun.aws.json: No such file or directoryDockerrun.aws.json:没有这样的文件或目录
【发布时间】:2019-08-27 13:30:55
【问题描述】:

许多开发人员。 这是我的第一个问题,我无法解决。

我正在使用 AWS For 部署 webapp 和项目。
现在我只想部署这么小的项目。
(就像基本的 django 项目

我已经在本地测试了这个(使用“python manage.py runserver”)。
并构建并运行 dockerfile。

但是 AWS 的部署不断失败。
我编写 Dockerfile 并使用它。
但是 AWS 对我说
“cat: /var/app/current/Dockerrun.aws.json: 没有这样的文件或目录”
我不明白它在说什么。

这是我在 DockerFile 中的代码

FROM        {{mydockerId}}/myproject:base

COPY        . /srv/FestivalMusicList
# static directory setting

RUN         cp -f /srv/FestivalMusicList/.config/nginx.conf     /etc/nginx/nginx.conf &&\
            cp -f /srv/FestivalMusicList/.config/nginx-app.conf /etc/nginx/sites-available/ &&\
            rm -f /etc/nginx/site-enabled/* &&\
            ln -sf /etc/nginx/sites-available/nginx-app.conf     /etc/nginx/sites-enabled/

RUN         cp /srv/FestivalMusicList/.config/supervisord.conf  /etc/supervisor/conf.d/
RUN         mkdir /var/log/celery

EXPOSE      80

这是错误

[2019-04-05T15:05:33.308Z] INFO  [3747]  - [Application deployment app-cdf1-190406_000132@1/StartupStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_0_festival_music_list/Command 04_setdata_genre] : Starting activity...
[2019-04-05T15:05:33.310Z] INFO  [3747]  - [Application deployment app-cdf1-190406_000132@1/StartupStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_0_festival_music_list/Command 04_setdata_genre] : Completed activity.
[2019-04-05T15:05:33.310Z] INFO  [3747]  - [Application deployment app-cdf1-190406_000132@1/StartupStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_0_festival_music_list] : Completed activity.
[2019-04-05T15:05:33.310Z] INFO  [3747]  - [Application deployment app-cdf1-190406_000132@1/StartupStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild] : Completed activity.
[2019-04-05T15:05:33.328Z] INFO  [3747]  - [Application deployment app-cdf1-190406_000132@1/StartupStage0/EbExtensionPostBuild] : Completed activity.
[2019-04-05T15:05:33.328Z] INFO  [3747]  - [Application deployment app-cdf1-190406_000132@1/StartupStage0/InfraCleanEbExtension] : Starting activity...
[2019-04-05T15:05:33.329Z] INFO  [3747]  - [Application deployment app-cdf1-190406_000132@1/StartupStage0/InfraCleanEbExtension] : Completed activity. Result:
  Cleaned ebextensions subdirectories from /tmp.
[2019-04-05T15:05:33.329Z] INFO  [3747]  - [Application deployment app-cdf1-190406_000132@1/StartupStage0] : Completed activity. Result:
  Application deployment - Command CMD-Startup stage 0 completed
[2019-04-05T15:05:33.329Z] INFO  [3747]  - [Application deployment app-cdf1-190406_000132@1/StartupStage1] : Starting activity...
[2019-04-05T15:05:33.329Z] INFO  [3747]  - [Application deployment app-cdf1-190406_000132@1/StartupStage1/AppDeployEnactHook] : Starting activity...
[2019-04-05T15:05:33.331Z] INFO  [3747]  - [Application deployment app-cdf1-190406_000132@1/StartupStage1/AppDeployEnactHook/00run.sh] : Starting activity...
[2019-04-05T15:05:39.636Z] INFO  [3747]  - [Application deployment app-cdf1-190406_000132@1/StartupStage1/AppDeployEnactHook/00run.sh] : Activity execution failed, because: cat: /var/app/current/Dockerrun.aws.json: No such file or directory
  cat: /var/app/current/Dockerrun.aws.json: No such file or directory
  01a93e5ed8e11b0c76133e5e446764a8ec95ddd1db144be5d3fceca9fd6c0813
  Docker container quit unexpectedly after launch: Docker container quit unexpectedly on Fri Apr  5 15:05:39 UTC 2019:. Check snapshot logs for details. (ElasticBeanstalk::ExternalInvocationError)
caused by: cat: /var/app/current/Dockerrun.aws.json: No such file or directory
  cat: /var/app/current/Dockerrun.aws.json: No such file or directory
  01a93e5ed8e11b0c76133e5e446764a8ec95ddd1db144be5d3fceca9fd6c0813
  Docker container quit unexpectedly after launch: Docker container quit unexpectedly on Fri Apr  5 15:05:39 UTC 2019:. Check snapshot logs for details. (Executor::NonZeroExitStatus

【问题讨论】:

    标签: amazon-web-services docker


    【解决方案1】:

    您在使用 Elastic Beanstalk 吗?如果是这样,您需要在您的根目录中添加Dockerrun.aws.json

    其内容示例:

    {
      "AWSEBDockerrunVersion": "1",
      "Image": {
        "Name": "janedoe/image",
        "Update": "true"
      },
      "Ports": [
        {
          "ContainerPort": "1234"
        }
      ],
      "Volumes": [
        {
          "HostDirectory": "/var/app/mydb",
          "ContainerDirectory": "/etc/mysql"
        }
      ],
      "Logging": "/var/log/nginx",
      "Entrypoint": "/app/bin/myapp",
      "Command": "--argument"
    }
    

    欲了解更多信息:Official Doc's

    【讨论】:

    • 我不记得如何解决这个老问题了。所以我不能使用你的建议。但是非常感谢您回答我的问题。如果我再遇到这样的问题,我会记住的~
    猜你喜欢
    • 2021-06-24
    • 2015-02-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-17
    • 2016-05-06
    • 2019-03-13
    相关资源
    最近更新 更多