使用docker composer在AWS beanstalk上部署docker

我试图在AWS beanstalk上部署多个node.js微服务,并且希望将它们部署在同一个实例上。 这是我第一次部署多个服务,所以有一些失败,我需要有人来帮助我。 所以,我试图首先将它们打包在docker集装箱中。 同时我正在使用dockercomposer php来pipe理这个结构。 它在本地虚拟机上启动并运行,但是当我部署到beanstalk时,遇到了一些问题。

我知道的:

  1. 我知道我必须select部署为多容器泊坞窗。
  2. pipe理多个node.js服务的最佳实践是使用docker composer。
  3. 我需要为node.js应用程序使用dockerrun.aws.json
  4. 我需要为该ecs实例创build任务定义。

我遇到问题的地方:

  1. 我只能findphp的dockerrun.aws.jsontask_definition.json模板,所以我无法validation这两个json文件中的node.jsconfiguration是否处于正确的形状。
  2. 看起来像docker-compose.ymldockerrun.aws.jsontask_definition.json正在做类似的工作。 我必须保持task_definition,但我仍然需要dockerrun.aws.json?
  3. 我试图在ecs中运行这个任务,但是它立刻停止了。 我怎样才能检查日志的任务?

我有:

在环境中找不到ecs任务定义(或空定义文件)

因为我的任务总是会立即停止。 如果我可以查看日志,那么我可以更容易地进行故障排除。

这是我的task_definition.json

 { "requiresAttributes": [], "taskDefinitionArn": "arn:aws:ecs:us-east-1:231440562752:task-definition/ComposerExample:1", "status": "ACTIVE", "revision": 1, "containerDefinitions": [ { "volumesFrom": [], "memory": 100, "extraHosts": null, "dnsServers": null, "disableNetworking": null, "dnsSearchDomains": null, "portMappings": [ { "hostPort": 80, "containerPort": 80, "protocol": "tcp" } ], "hostname": null, "essential": true, "entryPoint": null, "mountPoints": [ { "containerPath": "/usr/share/nginx/html", "sourceVolume": "webdata", "readOnly": true } ], "name": "nginxexpressredisnodemon_nginx_1", "ulimits": null, "dockerSecurityOptions": null, "environment": [], "links": null, "workingDirectory": null, "readonlyRootFilesystem": null, "image": "nginxexpressredisnodemon_nginx", "command": null, "user": null, "dockerLabels": null, "logConfiguration": null, "cpu": 99, "privileged": null } ], "volumes": [ { "host": { "sourcePath": "/ecs/webdata" }, "name": "webdata" } ], "family": "ComposerExample" } 

我有一个类似的问题,事实certificate,我存档在我的Archive.zip文件中的包含文件夹,从而给我这个结构在Archive.zip文件:

 RootFolder - Dockerrun.aws.json - Other files... 

事实certificate,通过仅存档RootFolder的内容(而不是文件夹本身),Amazon Beanstalk识别ECS任务定义文件。

希望这可以帮助。

类似的问题。 对我来说固定的是使用CLI工具,而不是压缩自己,只是运行eb deploy工作。

对我而言,只是确保文件的名称与AWS文档中描述的确切shell相匹配。

dockerfile.aws.json必须是正确的Dockerfile.aws.json