ECS无效的参考格式错误 [英] ECS invalid reference format error
问题描述
我尝试通过运行一个Task(由Task Definition定义)来使用Amazon ECS部署和运行一个简单的Dockerized Ruby后端,但是它无法运行我的命令并返回此错误:
I try to deploy and run a simple Dockerized Ruby backend using Amazon ECS by running a Task (defined by Task Definition) but it failed to run my command and returned this error:
CannotPullContainerError:API错误(400):无效的引用格式
CannotPullContainerError: API error (400): invalid reference format
我试图运行一个小的echo "Hello"
入口点命令,但是无论是exec形式还是shell形式,它都会返回相同的错误.我试图在本地终端上运行此命令,该命令运行良好:
I've tried to run a small Entrypoint command of echo "Hello"
but it's returning the same error regardless it's exec form or shell form. I tried to run this command in my local terminal it's running well:
$ docker-compose run job echo 'HELLO_WORLD'
HELLO_WORLD
这是错误消息,如群集任务的详细信息"部分所示:
This is the error message as shown in the Details section of my cluster task:
Status reason CannotPullContainerError: API error (400): invalid reference format
Entry point ["echo","HELLO"]
这是我的任务定义JSON(出于安全原因隐藏某些信息):
this is my Task Definition JSON (hiding certain information for security reason):
{
"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": []
}
更改entryPoint以使用命令也无法正常工作.
Changing entryPoint to use command doesn't work as well.
Status reason CannotPullContainerError: API error (400): invalid reference format
Command ["echo","HELLO"]
我是否缺少任何配置以使简单的echo
命令起作用?
Am I missing out any configuration to make a simple echo
command work?
推荐答案
无效的引用格式"表示docker试图解析的映像名称无效.在您的日志中:
"Invalid reference format" means that the image name docker is trying to parse is invalid. In your logs:
"image": "<ecs_image_arn>",
图像名称确实无效,需要用有效的图像名称替换.如果出于隐私考虑,您已在此问题中替换了该字符串,那么删除的部分就是您的错误所在.
The image name is indeed invalid and needs to be replaced with a valid image name. If that string has been replaced by you in this question for privacy, then the part removed is where your error exists.
这篇关于ECS无效的参考格式错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!