Dockerrun.aws.json:没有这样的文件或目录

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Dockerrun.aws.json:没有这样的文件或目录相关的知识,希望对你有一定的参考价值。

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

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

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

但是AWS持续部署失败。我编写Dockerfile并使用它。但是AWS对我说“猫:/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
答案

您是否正在使用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

以上是关于Dockerrun.aws.json:没有这样的文件或目录的主要内容,如果未能解决你的问题,请参考以下文章

返回码:1 输出:Dockerfile 和 Dockerrun.aws.json 都丢失,中止部署

为啥 AWS CodePipeline 抱怨“Dockerfile”和“Dockerrun.aws.json”?

从 Dockerrun.aws.json -AWS 增加 EBS 中的命令超时

每个环境单独的 Dockerrun.aws.json

ECR 存储库的 Dockerrun.aws.json 结构

如何使用 Elastic beanstalk 和 Dockerrun.aws.json 正确部署到 AWS?