首页 > 解决方案 > ECS 应用程序源包验证错误:我们期望一个 VALUE 令牌但得到:START_ARRAY

问题描述

我正在 Elastic Beanstalk 上构建多容器 docker 构建,并且每当我运行时eb deploy

我得到错误ECS Application sourcebundle validation error: We expected a VALUE token but got: START_ARRAY

我认为我的 Dockerrun.aws.json 可能有问题,但我似乎无法弄清楚它是什么。

这是我的 dockerrun.aws.json

{
"AWSEBDockerrunVersion": 2,
"containerDefinitions": [
    {
        "environment": [
            {
                "name": "ELASTICSEARCH_URL",
                "value": "elasticsearch:9200"
            }
        ],
        "essential": true,
        "image": "902260087874.dkr.ecr.ap-southeast-1.amazonaws.com/the-medical-agora",
        "memory": 128,
        "links": [
            "db",
            "elasticsearch"
        ],
        "mountPoints": [
            {
                "containerPath": "/usr/src/app",
                "sourceVolume": "."
            }
        ],
        "name": "app",
        "portMappings": [
            {
                "containerPort": 3000,
                "hostPort": 80
            }
        ]
    },
    {
        "memory": 128,
        "essential": true,
        "image": "postgres:10.3-alpine",
        "mountPoints": [
            {
                "containerPath": "/var/lib/postgresql/data",
                "sourceVolume": "Db"
            }
        ],
        "name": "db",
        "portMappings": [
            {
                "containerPort": 5432,
                "hostPort": 5432
            }
        ]
    },
    {
        "memory": 128,
        "essential": true,
        "image": "docker.elastic.co/elasticsearch/elasticsearch-oss:6.2.4",
        "mountPoints": [
            {
                "containerPath": "/usr/share/elasticsearch/data",
                "sourceVolume": "Esdata1"
            }
        ],
        "name": "elasticsearch"
    }
],
"volumes": [
    {
        "host": {
            "sourcePath": "esdata1"
        },
        "name": "Esdata1"
    },
    {
        "host": {
            "sourcePath": "db"
        },
        "name": "Db"
    },
    {
        "host": {
            "sourcePath": "."
        },
        "name": "_"
    }
]
}

这很奇怪,因为当我在它上面运行这个 dockerrun.aws.json JSON 模式linter时,它似乎做得很好。

当我使用eb local run. 它似乎只有在我将它部署到 Elastic Beanstalk 时才会中断。

标签: ruby-on-railsamazon-web-servicesdockeramazon-elastic-beanstalk

解决方案


嘿伙计们,在阅读了我发现问题的文档后。eb deploy

虽然我修复了 Dockerrun.aws.json 文件,但eb deploy直到我创建一个新的git commit.

所以我只是跑git add .git commit然后跑得git push很好。

之后,当我运行eb deploy它时,我使用了我的新 Dockerrun.aws.json,我的问题得到了解决。


推荐阅读