Zalenium-Node容器终止并使用代理连续重启

时间:2019-01-31 19:43:50

标签: selenium protractor zalenium

docker pull elgalu/selenium
docker pull dosel/zalenium
docker run --rm --name zalenium -p 4444:4444 
-v /var/run/docker.sock:/var/run/docker.sock 
-e "zalenium_http_proxy=http://example.com:80" 
-e "zalenium_https_proxy=http://example.com:80" 
-e zalenium_no_proxy="localhost,127.0.0.1,http://example.com" 
--privileged dosel/zalenium start --desiredContainers 2 --maxDockerSeleniumContainers 2 --maxTestSessions 5

在运行zalenium容器时使用代理时,节点容器突然关闭,每隔2分钟就会创建一个新容器。因此,如果测试花费了2分钟以上,则失败并显示以下错误消息

WebDriverError: cannot forward the request Failed to connect to /192.168.64.4:40000

每2分钟看到节点重新启动

zalenium    | 20:16:50.110 [Thread-10] INFO  d.z.e.z.registry.ZaleniumRegistry - Registered a node http://172.18.0.5:40000
zalenium    | 20:16:50.899 [Thread-11] INFO  d.z.e.z.registry.ZaleniumRegistry - Registered a node http://172.18.0.6:40001
zalenium    | 20:18:52.592 [http://172.18.0.5:40000] INFO  d.z.e.z.p.DockerSeleniumRemoteProxy - Marking node down.
zalenium    | 20:18:52.637 [http://172.18.0.6:40001] INFO  d.z.e.z.p.DockerSeleniumRemoteProxy - Marking node down.
zalenium    | 20:19:08.529 [Thread-12] INFO  d.z.e.z.registry.ZaleniumRegistry - Registered a node http://172.18.0.5:40002
zalenium    | 20:19:09.735 [Thread-13] INFO  d.z.e.z.registry.ZaleniumRegistry - Registered a node http://172.18.0.6:40003

请让我知道此问题的解决方案。

1 个答案:

答案 0 :(得分:0)

使用最新的docker和图像尝试以下命令

docker run --rm --name zalenium -p 4444:4444 -v /var/run/docker.sock:/var/run/docker.sock -e "zalenium_http_proxy=http://example.com:80" -e "zalenium_https_proxy=http://example.com:80" -e zalenium_no_proxy="localhost,127.0.0.1,http://example.com,172.*" --privileged dosel/zalenium start --desiredContainers 2 --maxDockerSeleniumContainers 2 --maxTestSessions 5