3

I like to setup a Selenium Grid on AWS with the official Docker images, that can be found here https://github.com/SeleniumHQ/docker-selenium

Hub and nodes should reside on different machines / docker hosts.

I use an ambassador container, as described here: https://docs.docker.com/articles/ambassador_pattern_linking/

(hub) --> (selenium-ambassador) --network--> (selenium-ambassador) --> (node)

I created two EC2 instances and executed the following commands:

On the hub machine:

$ docker run -d --name selenium-hub selenium/hub:2.47.1
$ docker run -d --link selenium-hub:selenium-hub --name selenium_ambassador -p 4444:4444 svendowideit/ambassador

On the node machine:

$ docker run -d --name selenium_ambassador --expose 4444 -e SELENIUM_PORT_4444_TCP=tcp://<public-AWS-EC2-IP>:4444 svendowideit/ambassador
$ docker run -d --link selenium_ambassador:selenium-hub selenium/node-chrome:2.47.1

After running the last command, I get the following error message on the node machine:

Not linked with a running Hub container

Security groups on each EC2 machine allow port 22 and 4444.

I hope, anyone can help me or give me a clue? Thanks in advance.

1 Answers1

10

After some more research, I've found out that no extra ambassador container is necessary. The node and hub can communicate directly after setting the appropriate parameters / environment variables REMOTE_HOST, HUB_PORT_4444_TCP_ADDR, HUB_PORT_4444_TCP_PORT. There is also a respective resolved issue https://github.com/SeleniumHQ/docker-selenium/issues/51

To put it in a nutshell, just execute the following commands:

Hub

$ docker run -d -p 4444:4444 --name selenium-hub selenium/hub:2.47.1

Node

$ docker run -d -p 5555:5555 -e REMOTE_HOST="http://<PASTE-NODE-IP>:5555" -e HUB_PORT_4444_TCP_ADDR="<PASTE-HUB-IP>" -e HUB_PORT_4444_TCP_PORT="4444" --name chrome-node selenium/node-chrome:2.47.1