简体   繁体   English

在AWS ECS上使用Docker Compose进行Selenium Grid设置

[英]Selenium Grid Setup using Docker Compose on AWS ECS

Context : 内容:

I am trying to setup a selenium grid to run my UI tests on CI.CI is Jenkins 2.0 and it runs on AWS ECS.When I create a selenium grid using the docker compose and invoke the tests on my MAC (OS Sierra) , it works perfectly. 我正在尝试设置一个硒网格以在CI上运行我的UI测试.CI是Jenkins 2.0,它可以在AWS ECS上运行。当我使用docker compose创建硒网格并在我的MAC(OS Sierra)上调用测试时,它完美地工作。

When run on the AWS ECS , it shows me an : java.awt.AWTError: Can't connect to X11 window server using '99.0' as the value of the DISPLAY variable. 在AWS ECS上运行时,它向我显示:java.awt.AWTError:无法使用“ 99.0”作为DISPLAY变量的值连接到X11窗口服务器。

The test code itself is in a container and using a bridge network I have added the container to the same network as the grid. 测试代码本身在容器中,并使用网桥网络将容器添加到与网格相同的网络中。

The docker compose looks something like this : 码头工人组成看起来像这样:

version: '3'
services:

chromenode:
  image: selenium/node-chrome:3.4.0
  volumes:
    - /dev/shm:/dev/shm
    - /var/run/docker.sock:/var/run/docker.sock
  container_name: chromenode
  hostname: chromenode
  depends_on: 
    - seleniumhub
  ports: 
    - "5900:5900"
  environment:
    - "HUB_PORT_4444_TCP_ADDR=seleniumhub"
    - "HUB_PORT_4444_TCP_PORT=4444"
  networks:
    - grid_network

seleniumhub:
  image: selenium/hub:3.4.0
  ports: 
   - "4444:4444"
  container_name: seleniumhub
  hostname: seleniumhub
  networks:
    - grid_network
  volumes:
    - /var/run/docker.sock:/var/run/docker.sock

 testservice:
 build:
  context: .
  dockerfile: DockerfileTest
 networks:
   - grid_network

 networks:
   grid_network:
     driver: bridge

Please let me know if more info is required. 请让我知道是否需要更多信息。

unset DISPLAY   This helped me to solve the problem

This helps in most cases (eg starting application servers or other java based tools) and avoids to modify all that many command lines. 这在大多数情况下会有所帮助(例如,启动应用程序服务器或其他基于Java的工具),并且避免修改所有这么多的命令行。

It can also be comfortable to add it to the .bash_profile for a dedicated app-server/tools user. 也可以将其添加到专用的app-server / tools用户的.bash_profile中。 Can you please try this - no_proxy="" 您可以尝试一下吗-no_proxy =“”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM