任务在我的AWS群集上成功运行,但是当我尝试访问网页时,显示“无法访问此网站”错误
我创建了一个简单的java spring应用程序(在Tomcat服务器上运行),该应用程序具有获取和发布请求。获取显示一条简单消息。我从中创建了一个jar和一个dockerfile。然后是码头工人文件中的图像,它向我显示了我在本地主机上的消息。然后,我将其上传到aws存储库,创建了一个使用默认端口80的集群。然后,我从存储库映像创建了一个任务。最后,我在aws群集上运行它,它表明我的任务正在运行,但是当我尝试使用ec2公用ip和端口8080 / test进行访问时,它提示我“无法访问此站点”
我的任务定义看起来像这样
{
"ipcMode": null,
"executionRoleArn": null,
"containerDefinitions": [
{
"dnsSearchDomains": null,
"logConfiguration": null,
"entryPoint": null,
"portMappings": [
{
"hostPort": 8080,
"protocol": "tcp",
"containerPort": 8080
}
],
"command": null,
"linuxParameters": null,
"cpu": 0,
"environment": [],
"resourceRequirements": null,
"ulimits": null,
"dnsServers": null,
"mountPoints": [],
"workingDirectory": null,
"secrets": null,
"dockerSecurityOptions": null,
"memory": 512,
"memoryReservation": null,
"volumesFrom": [],
"stopTimeout": null,
"image": "some image",
"startTimeout": null,
"dependsOn": null,
"disableNetworking": null,
"interactive": null,
"healthCheck": null,
"essential": true,
"links": null,
"hostname": null,
"extraHosts": null,
"pseudoTerminal": null,
"user": null,
"readonlyRootFilesystem": null,
"dockerLabels": null,
"systemControls": null,
"privileged": null,
"name": "rtf-test"
}
],
"placementConstraints": [],
"memory": null,
"taskRoleArn": null,
"compatibilities": [
"EC2"
],
"taskDefinitionArn": "arn:aws:ecs:us-east-2:task-definition/rtf-test:1",
"family": "rtf-test",
"requiresAttributes": [
{
"targetId": null,
"targetType": null,
"value": null,
"name": "com.amazonaws.ecs.capability.ecr-auth"
}
],
"pidMode": null,
"requiresCompatibilities": [
"EC2"
],
"networkMode": null,
"cpu": null,
"revision": 1,
"status": "ACTIVE",
"proxyConfiguration": null,
"volumes": []
}
请参阅与本地主机相同的消息