ECS无效参考格式错误

2023-12-26

我尝试通过运行任务(由任务定义定义)来使用 Amazon ECS 部署和运行简单的 Dockerized Ruby 后端,但它无法运行我的命令并返回以下错误:

CannotPullContainerError:API 错误 (400):参考格式无效

我尝试运行一个小的入口点命令echo "Hello"但无论是 exec 形式还是 shell 形式,它都会返回相同的错误。我尝试在本地终端中运行此命令,它运行良好:

$ docker-compose run job echo 'HELLO_WORLD'
HELLO_WORLD

这是我的集群任务的“详细信息”部分中显示的错误消息:

Status reason   CannotPullContainerError: API error (400): invalid reference format
  Entry point   ["echo","HELLO"]

这是我的任务定义 JSON(出于安全原因隐藏某些信息):

{
    "executionRoleArn": null,
    "containerDefinitions": [
        {
            "dnsSearchDomains": null,
            "logConfiguration": null,
            "entryPoint": [
                "echo",
                "HELLO"
            ],
            "portMappings": [],
            "command": [],
            "linuxParameters": null,
            "cpu": 0,
            "environment": [
                {
                    "name": "RAILS_ENV",
                    "value": "production"
                }
            ],
            "ulimits": null,
            "dnsServers": null,
            "mountPoints": [],
            "workingDirectory": null,
            "dockerSecurityOptions": null,
            "memory": 7000,
            "memoryReservation": null,
            "volumesFrom": [],
            "image": "<ecs_image_arn>",
            "disableNetworking": false,
            "healthCheck": null,
            "essential": true,
            "links": null,
            "hostname": null,
            "extraHosts": null,
            "user": null,
            "readonlyRootFilesystem": null,
            "dockerLabels": null,
            "privileged": null,
            "name": "<name>"
        }
    ],
    "memory": null,
    "taskRoleArn": "arn:aws:iam::<id>:role/<name>",
    "family": "<test-cluster>",
    "requiresCompatibilities": [
        "EC2"
    ],
    "networkMode": null,
    "cpu": null,
    "volumes": [],
    "placementConstraints": []
}

将入口点更改为使用命令也不起作用。

Status reason   CannotPullContainerError: API error (400): invalid reference format
    Command ["echo","HELLO"]

我是否遗漏了任何配置来制作简单的echo指挥工作?


“无效的参考格式”意味着docker试图解析的镜像名称无效。在你的日志中:

   "image": "<ecs_image_arn>",

图片名称确实无效,需要替换为有效的图片名称。如果您出于隐私原因在此问题中替换了该字符串,则删除的部分就是您的错误所在的位置。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

ECS无效参考格式错误 的相关文章

随机推荐