适用于AWS和Selenium Grid的Docker-连接被拒绝/主机没有路由(主机不可达) [英] Docker for AWS and Selenium Grid - Connection refused / No route to host (Host unreachable)

查看:263
本文介绍了适用于AWS和Selenium Grid的Docker-连接被拒绝/主机没有路由(主机不可达)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要实现的目标是使用Selenium Grid进行可伸缩的按需测试基础结构。

What I am trying to achieve is a scalable and on-demand test infrastructure using Selenium Grid.

我可以启动并运行所有东西,但最终得到的结果是是这样的:

I can get everything up and running but what I end up with is this:

所有这些都是:


  1. 适用于AWS的Docker (CloudFormation堆栈)

  2. docker-selenium

  3. Docker撰写文件(如下)

  1. Docker for AWS (CloudFormation Stack)
  2. docker-selenium
  3. Docker compose file (below)

使用的隐含软件是:

Docker群集

堆栈

这是我可以完成的事情:

Here is what I can accomplish:


  1. 创建,登录并ping所有主机&节点,请遵循以下指南:为AWS部署Docker

在查询结束时运行以下命令,使用撰写文件进行部署:

Deploy using the compose the file at the end of this inquiry by running:

docker stack deploy -c docker-compose.yml grid


  • 查看使用AWS自动提供的面向公众的DNS名称的Selenium Grid控制台(成功创建堆栈后)。这是有关此主题的有用条目: Docker Swarm Mode

    以下是我正在使用的撰写文件的内容:

    Here is are the contents of the compose file I am using:

    version: '3'
    
    services:
      hub:
        image: selenium/hub:3.4.0-chromium
        ports:
          - 4444:4444
        networks:
          - selenium
        environment:
          - JAVA_OPTS=-Xmx1024m
        deploy:
          update_config:
            parallelism: 1
            delay: 10s
          placement:
            constraints: [node.role == manager]
    
      chrome:
        image: selenium/node-chrome:3.4.0-chromium  
        networks:
          - selenium
        depends_on:
          - hub
        environment:
          - HUB_PORT_4444_TCP_ADDR=hub
          - HUB_PORT_4444_TCP_PORT=4444
        deploy:
        placement:
          constraints: [node.role == worker]
    
      firefox:
        image: selenium/node-firefox:3.4.0-chromium
        networks:
          - selenium
        depends_on:
          - hub
        environment:
          - HUB_PORT_4444_TCP_ADDR=hub
          - HUB_PORT_4444_TCP_PORT=4444
        deploy:
        placement:
          constraints: [node.role == worker]
    
    networks:
      selenium:
    

    对此的任何指导问题将不胜感激。谢谢。

    Any guidance on this issue will be greatly appreciated. Thank you.

    我也尝试过开放整个集群的端口:

    I have also tried opening up ports across the swarm:

    swarm-exec docker service update --publish-add 5555:5555 gird
    


    推荐答案

    一个快速的Google提出了 https://github.com/ SeleniumHQ / docker-selenium / issues / 255 。您需要向Chrome和Firefox节点添加以下内容:

    A quick Google brought up https://github.com/SeleniumHQ/docker-selenium/issues/255. You need to add the following to the Chrome and Firefox nodes:

    entrypoint: bash -c 'SE_OPTS="-host $$HOSTNAME" /opt/bin/entry_point.sh'
    

    这是因为容器中有两个IP地址群集模式和节点选择了错误的地址并将其发布到集线器。此更改将使节点公布其主机名,以便集线器可以改为通过DNS查找节点。

    This is because the containers have two IP addresses in Swarm Mode and the nodes are picking up the wrong address and advertising that to the hub. This change will have the nodes advertise their hostname so the hub can find the nodes by DNS instead.

    这篇关于适用于AWS和Selenium Grid的Docker-连接被拒绝/主机没有路由(主机不可达)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆