Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2 (or more) chrome containers in the same server connected to the same hub #140

Closed
eyal919 opened this issue Jan 4, 2016 · 5 comments
Closed

Comments

@eyal919
Copy link

eyal919 commented Jan 4, 2016

Hi All,
There is no clear docs about how to connect 2 (or more) containers to the same hub in the same server.
What i'm doning is:
HUB: docker run -d --name hub -p 4444:4444 -e GRID_BROWSER_TIMEOUT=360000 selenium/hub
NODE #1: docker run -d --link hub:hub -P --name node555 -p 5555:5555-v /dev/shm:/dev/shm selenium/node-chrome
NODE #2:???
I'm missing the command for NODE #2..

If anyone can help it will great...
Thanks,

@SpencerMalone
Copy link

You just do it again with a different container name (or leave off the name flag for a random container name). If you want port 5555 exposed on the containers, just map it to a different port on the host like so: -p 5554:5555

@alexkogon
Copy link
Contributor

@SpencerMalone don't you also have to tell the Hub that you are listening on 5554 instead of 5555?

@alexkogon
Copy link
Contributor

Hi folks,

I've been playing around with running nodes on and off the same container host as the hub. When running a node on the same Docker host, and specifying the Hub machine and port via

-e HUB_PORT_4444_TCP_ADDR= -e HUB_PORT_4444_TCP_PORT=

everything works, as the node can find the Hub and then tells the hub the IP address and port it is using INTERNALLY to the VM, which is of course accessible on the Hub host as it is running on the same machine, so mapping port 5555 on the host to the Docker image with a -p 5555:5555 is not necessary.

However when running the host remotely, you not only have to expose the port on the Docker host via -p, you also need to tell the node to pass the Docker host's address and the port you are exposing via the REMOTE_HOST variable, a la:

-e REMOTE_HOST=http://<node's Docker host address>:5555
(assuming you mapped 5555 to 5555 with -p 5555:5555)

This way the hub knows where to look for the Node when calling it back; by default the hub will tell the hub the IP address of the VM it is running in and the port (which will be 5555) but this is not accessible from the Hub machine, which is exactly why you have to map a port on the Docker host to forward to the VM.

So, for example, assuming the Docker host for the nodes was 10.1.1.2, and the Hub was on 10.1.1.1 port 80, you would run the nodes as:

docker run -d -e HUB_PORT_4444_TCP_ADDR=10.1.1.1 -e HUB_PORT_4444_TCP_PORT=80 -e REMOTE_HOST=http://10.1.1.2:5555 -p 5555:5555 selenium/node-firefox
docker run -d -e HUB_PORT_4444_TCP_ADDR=10.1.1.1 -e HUB_PORT_4444_TCP_PORT=80 -e REMOTE_HOST=http://10.1.1.2:5556 -p 5556:5555 selenium/node-firefox
docker run -d -e HUB_PORT_4444_TCP_ADDR=10.1.1.1 -e HUB_PORT_4444_TCP_PORT=80 -e REMOTE_HOST=http://10.1.1.2:5557 -p 5557:5555 selenium/node-firefox
.
.
.

I found this by searching through the code base here (the entry_point.sh Docker autolaunch file) but don't see it in the README documentation.

@L0wry
Copy link

L0wry commented Dec 30, 2016

You have just made my day after a 4 hour trawl online

Thank you!

@diemol
Copy link
Member

diemol commented Jun 25, 2017

Thanks all for the great info!
I'll close this issue since the original request has been already solved by the community.

@diemol diemol closed this as completed Jun 25, 2017
@lock lock bot locked and limited conversation to collaborators Aug 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants