我正在尝试让Docker容器在ECS中运行。我创建了一个基本的express
应用,该应用正在侦听端口3000。这是我的AWS设置。我有一个ECS集群,其中只有一项任务。
我的AWS存储库中有一个容器,该容器在此集群中作为任务运行。
{
"executionRoleArn": "arn:aws:iam::035892600013:role/ecsTaskExecutionRole",
"containerDefinitions": [
{
"dnsSearchDomains": null,
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "/ecs/first-run-task-definition",
"awslogs-region": "us-west-2",
"awslogs-stream-prefix": "ecs"
}
},
"entryPoint": [],
"portMappings": [
{
"hostPort": 3000,
"protocol": "tcp",
"containerPort": 3000
}
],
"command": [],
"linuxParameters": null,
"cpu": 0,
"environment": [],
"ulimits": null,
"dnsServers": null,
"mountPoints": [],
"workingDirectory": null,
"dockerSecurityOptions": null,
"memory": null,
"memoryReservation": null,
"volumesFrom": [],
"image": "035892600013.dkr.ecr.us-west-2.amazonaws.com/test-express:latest",
"disableNetworking": null,
"healthCheck": null,
"essential": true,
"links": [],
"hostname": null,
"extraHosts": null,
"user": null,
"readonlyRootFilesystem": null,
"dockerLabels": null,
"privileged": null,
"name": "test-express"
}
],
"placementConstraints": [],
"memory": "512",
"taskRoleArn": null,
"compatibilities": [
"EC2",
"FARGATE"
],
"taskDefinitionArn": "arn:aws:ecs:us-west-2:035892600013:task-definition/first-run-task-definition:5",
"family": "first-run-task-definition",
"requiresAttributes": [
...
],
"requiresCompatibilities": [
"FARGATE"
],
"networkMode": "awsvpc",
"cpu": "256",
"revision": 5,
"status": "ACTIVE",
"volumes": []
}
从JSON中,您可以看到该容器正在侦听端口3000,但是我无法通过url:3000
访问该应用程序。它只是旋转。我还想念什么?
我尝试卷曲应用程序,但一无所获。卷曲只是坐在等待响应。我确实确认应用程序正在容器中运行。这是日志: