无效的Dockerrun.aws.json文件

时间:2018-08-21 15:56:07

标签: docker elastic-beanstalk

我尝试使用this package来生成有效的Dockerrun.aws.json文件。但是,我遇到了一些问题。

Dockerrun.aws.json

{
    "containerDefinitions": [
        {
            "command": [
                "./wait-for-it.sh",
                "db:5432",
                "--",
                "./EXECUTABLE"
            ],
            "essential": true,
            "image": "gregpmillr/IMG",
            "memory": 512,
            "links": [
                "db"
            ],
            "name": "app",
            "portMappings": [
                {
                    "containerPort": 8080,
                    "hostPort": 443
                }
            ]
        },
        {
            "environment": [
                {
                    "name": "POSTGRES_DB",
                    "value": "db"
                },
                {
                    "name": "POSTGRES_USER",
                    "value": "dbuser"
                },
                {
                    "name": "POSTGRES_PASSWORD",
                    "value": "dbpw"
                }
            ],
            "essential": true,
            "image": "postgres",
            "memory": 512,
            "name": "db",
            "portMappings": [
                {
                    "containerPort": 5432,
                    "hostPort": 6000
                }
            ]
        }
    ],
    "family": "",
    "volumes": []
}

运行eb deploy后出现错误:

  

错误无效的Dockerrun.aws.json版本,中止部署

有什么想法可能不正确吗?

1 个答案:

答案 0 :(得分:2)

Elastic Beanstalk Dockerrun.aws.json(用于多容器Docker设置)必须包含"AWSEBDockerrunVersion": 2的键值对。

此外,我不认为Elastic Beanstalk支持"family""containerDefinitions.command"。看来您已经创建了task definition for Amazon ECS,该服务的配置和部署与Elastic Beanstalk不同。