Amazon web services AWS fargate链路网格

Amazon web services AWS fargate链路网格,amazon-web-services,selenium-grid,aws-fargate,Amazon Web Services,Selenium Grid,Aws Fargate,我正在尝试启动selenium网格服务器,并使用fargate将firefox节点连接到它。我使用aws控制台,因为我对编写cloudformation没有信心。我想链接两个容器hub和selenium/firefox。在fargate中,默认网络模式为awsvpc,我们不能使用传统的“链接”参数。其中一个教程视频建议两个容器可以使用本地环回接口(通常称为localhost/127.0.0.1)进行通信。下面给出了我的任务定义。但它仍然不起作用。感谢您的帮助 { "executionRoleAr

我正在尝试启动selenium网格服务器,并使用fargate将firefox节点连接到它。我使用aws控制台,因为我对编写cloudformation没有信心。我想链接两个容器hub和selenium/firefox。在fargate中,默认网络模式为awsvpc,我们不能使用传统的“链接”参数。其中一个教程视频建议两个容器可以使用本地环回接口(通常称为localhost/127.0.0.1)进行通信。下面给出了我的任务定义。但它仍然不起作用。感谢您的帮助

{
"executionRoleArn": "arn:aws:iam::xxxxxxxxx:role/ecsTaskExecutionRole",
"containerDefinitions": [
{
  "dnsSearchDomains": null,
  "logConfiguration": {
    "logDriver": "awslogs",
    "options": {
      "awslogs-group": "/ecs/first-run-task-definition",
      "awslogs-region": "us-xxxx-x",
      "awslogs-stream-prefix": "ecs"
    }
  },
  "entryPoint": [],
  "portMappings": [
    {
      "hostPort": 4444,
      "protocol": "tcp",
      "containerPort": 4444
    }
  ],
  "command": [],
  "linuxParameters": null,
  "cpu": 0,
  "environment": [
    {
      "name": "SE_OPTS",
      "value": "-debug"
    }
  ],
  "mountPoints": [],
  "volumesFrom": [],
  "image": "selenium/hub:latest",
  "disableNetworking": null,
  "essential": true,
  "links": [],
  "hostname": null,
  "extraHosts": null,
  "user": null,
  "readonlyRootFilesystem": null,
  "dockerLabels": null,
  "privileged": null,
  "name": "hub"
},
{
  "dnsSearchDomains": null,
  "logConfiguration": {
    "logDriver": "awslogs",
    "options": {
      "awslogs-group": "/ecs/first-run-task-definition",
      "awslogs-region": "us-xxxx-1",
      "awslogs-stream-prefix": "ecs"
    }
  },
  "entryPoint": null,
  "portMappings": [],
  "command": null,
  "linuxParameters": null,
  "cpu": 0,
  "environment": [
    {
      "name": "HUB_PORT_4444_TCP_ADDR",
      "value": "127.0.0.1"
    },
    {
      "name": "HUB_PORT_4444_TCP_PORT",
      "value": "4444"
    }
  ],
  "volumesFrom": [],
  "image": "selenium/node-firefox:latest",
  "disableNetworking": null,
  "essential": true,
  "links": [],
  "hostname": null,
  "extraHosts": null,
  "user": null,
  "readonlyRootFilesystem": null,
  "dockerLabels": null,
  "privileged": null,
  "name": "firefox"
}
],
"placementConstraints": [],
 "memory": "1024",
 "taskRoleArn": "arn:aws:iam::xxxxxxx:role/ecsTaskExecutionRole",
"compatibilities": [
   "EC2",
   "FARGATE"
  ],
  "taskDefinitionArn": "arn:aws:ecs:us-xxxx-1:xxxxx:task-definition/first-
  run-task-definition:10",
   "family": "first-run-task-definition",
  "requiresAttributes": [
 {
  "targetId": null,
  "targetType": null,
  "value": null,
  "name": "com.amazonaws.ecs.capability.docker-remote-api.1.18"
},
{
  "targetId": null,
  "targetType": null,
  "value": null,
  "name": "ecs.capability.task-eni"
},
{
  "targetId": null,
  "targetType": null,
  "value": null,
  "name": "com.amazonaws.ecs.capability.task-iam-role"
},
{
  "targetId": null,
  "targetType": null,
  "value": null,
  "name": "ecs.capability.execution-role-awslogs"
},
{
  "targetId": null,
  "targetType": null,
  "value": null,
  "name": "com.amazonaws.ecs.capability.logging-driver.awslogs"
},
{
  "targetId": null,
  "targetType": null,
  "value": null,
  "name": "com.amazonaws.ecs.capability.docker-remote-api.1.19"
}
  ],
"requiresCompatibilities": [
  "FARGATE"
],
 "networkMode": "awsvpc",
 "cpu": "512",
 "revision": 10,
 "status": "ACTIVE",
 "volumes": []
}

您是否尝试过使用
HUB\u PORT\u 4444\u TCP\u ADDR=localhost
?我正在使用一组不同的环境变量,但将集线器IP设置为localhost对我来说很有效。以下是我的Firefox容器任务定义的环境部分:

{
    "environment": [
        {
            "name": "HUB_HOST",
            "value": "localhost"
        },
        {
            "name": "HUB_PORT",
            "value": "4444"
        },
        {
            "name": "NODE_MAX_INSTANCES",
            "value": "10"
        },
        {
            "name": "NODE_MAX_SESSION",
            "value": "10"
        }
    ]
}