Docker-selenium: Chrome Node Fails to Start in Swarm Mode

Created on 14 Oct 2016  路  17Comments  路  Source: SeleniumHQ/docker-selenium

Meta -

Image(s):

Docker Version: Docker version 1.12.2

I'm running the following w/ AWS EC2 instances (3 total hosts):

docker network create seleniumnet --driver overlay
docker service create --name hub --network seleniumnet -p 4444:4444 selenium/hub
docker service create --name chrome --network seleniumnet --replicas 2 selenium/node-chrome

But docker service ps chromeshows that the chrome nodes start and then fail immediately w/ a non-zero exit status. I can't see why, though.

Any ideas why the chrome nodes are failing so quickly. I've even tried allowing all TCP and UDP traffic on the subnet.

Most helpful comment

@ddavison finally got it working! Thank you for the feedback and updates to the project. Tested with both Chrome and Firefox on 3.0.0-cerium.

Got the grid up and running by passing in the -host parameter into the nodes service creation command above and dynamically looking up the host name of the running container and passing it to entry_point.sh as SE_OPTS.

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

All 17 comments

docker logs 6e6f5384df1d
Not linked with a running Hub container

i believe this might be related to #238

I just realized I need to pass in -e HUB_PORT_4444_TCP_ADDR=hub, but I'm still seeing no nodes in the console. Going to open more ports or try the ip address.

The solution suggested here https://github.com/SeleniumHQ/docker-selenium/issues/255#issuecomment-238645738 though not ideal, works.

@testphreak thanks a lot. I'm trying that, but get

REMOTE_HOST variable is set, appending -remoteHost
Exception in thread "main" com.beust.jcommander.ParameterException: Unknown option: -remoteHost
    at com.beust.jcommander.JCommander.parseValues(JCommander.java:742)
    at com.beust.jcommander.JCommander.parse(JCommander.java:282)
    at com.beust.jcommander.JCommander.parse(JCommander.java:265)
    at com.beust.jcommander.JCommander.<init>(JCommander.java:210)
    at org.openqa.grid.selenium.GridLauncherV3$3.setConfiguration(GridLauncherV3.java:257)
    at org.openqa.grid.selenium.GridLauncherV3.buildLauncher(GridLauncherV3.java:147)
    at org.openqa.grid.selenium.GridLauncherV3.main(GridLauncherV3.java:73)

that might be because you are using the latest. if you are using Latest, you need to abide by Selenium 3.0.

Try using selenium/hub and node-chrome using version 2.53.1-beryllium with that option.

Here are the steps I'm using to try to get Selenium Grid + Docker connected via docker swarm in AWS. If anyone else has gotten this working, please let me know if you see anything wrong:

https://gist.github.com/fingermark/5360ec1cb6fc1a51f01985557cc76187

Just wanted to add some logs. I'm now manually specifying the hub IP address based on this hub log:

19:24:36.804 INFO - Nodes should register to http://10.0.0.2:4444/grid/register/
19:24:36.804 INFO - Selenium Grid hub is up and running

Chrome node log:

12:33:14.645 INFO - Registering the node to the hub: http://10.0.0.2:4444/grid/register
12:35:14.936 INFO - Couldn't register this node: Error sending the registration request: Connect to 10.0.0.2:4444 [/10.0.0.2] failed: connect timed out

Hi @ddavison, I am unable to setup a selenium grid either using swarm mode using 3.0.0-x. The approach I linked above works only with 2.53.1 images.

So what is the approach we need to abide by as you mentioned above? Do you have any suggestions for setting up a Selenium Grid in Swarm mode with 3.0.0?

Adding log from a node container -

REMOTE_HOST variable is set, appending -remoteHost
Exception in thread "main" com.beust.jcommander.ParameterException: Unknown option: -remoteHost
    at com.beust.jcommander.JCommander.parseValues(JCommander.java:742)
    at com.beust.jcommander.JCommander.parse(JCommander.java:282)
    at com.beust.jcommander.JCommander.parse(JCommander.java:265)
    at com.beust.jcommander.JCommander.<init>(JCommander.java:210)
    at org.openqa.grid.selenium.GridLauncherV3$3.setConfiguration(GridLauncherV3.java:257)
    at org.openqa.grid.selenium.GridLauncherV3.buildLauncher(GridLauncherV3.java:147)
    at org.openqa.grid.selenium.GridLauncherV3.main(GridLauncherV3.java:73)

@testphreak see #307

@fingermark same to you. since this appears to be your issue also, I am closing this.

Please see the comments in #307.

REMOTE_HOST has been removed. Please use SE_OPTS="-hubHost <host> -hubPort <port> instead of -remoteHost.

@ddavison please review my follow up comments in #307. I am not sure if remoteHost has been removed with v3. I still see it under configuration. Appreciate the help.

screen shot 2016-10-17 at 1 56 27 pm

remoteHost = host + port therefore there isn't any reason for configuring it.

https://github.com/SeleniumHQ/selenium/blob/master/java/server/src/org/openqa/grid/internal/utils/configuration/GridNodeConfiguration.java#L69

You'll notice that the @Parameter is not configurable for this particular String.

@ddavison finally got it working! Thank you for the feedback and updates to the project. Tested with both Chrome and Firefox on 3.0.0-cerium.

Got the grid up and running by passing in the -host parameter into the nodes service creation command above and dynamically looking up the host name of the running container and passing it to entry_point.sh as SE_OPTS.

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

glad to hear it @testphreak, YES. you can specify the host and port in the SE_OPTS variable

-e SE_OPTS="-host myhost -port 5556"

and it will connect to the hub with that host and port.

@testphreak could you share your final implementation having this scenario working?
I'm running the hub and nodes in different hosts, for instance I'm using docker swarm to configure the network, but I'm not able to provide a $HOSTNAME on the SE_OPTS when creating the nodes that do not result on a "connection refused" error when trying to register the node on the hub. Thanks!

Hi @rosariomgomez, please provide more details regarding your implementation such as your environment, OS, Docker version and the commands you are running? That will help me troubleshoot the issue you're seeing.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

testphreak picture testphreak  路  6Comments

vikramvi picture vikramvi  路  6Comments

Manolo2014 picture Manolo2014  路  3Comments

Bernardoow picture Bernardoow  路  4Comments

lluisteamcmp picture lluisteamcmp  路  6Comments