Docker-selenium: Unable to connect remote docker selenium node to remote docker hub

Created on 15 Oct 2015  路  13Comments  路  Source: SeleniumHQ/docker-selenium

I am trying to connect the "docker selenium remote node" to "remote docker hub", But it's not connecting, It shows the connection refused exception, Even I can connect my "remote node" to "docker hub". please help me. and my commands are here.
Hub:
docker run -d -p 4444:4444 --name my_hub selenium/hub:2.47.1
Node:
docker run -d -p 5558:5555 -e REMOTE_HOST="http://172.21.113.202:4444" -e HUB_PORT_4444_TCP_ADDR="172.21.113.202" -e HUB_PORT_4444_TCP_PORT="4444" --name firefox selenium/node-firefox:2.47.1
screen shot 2015-10-12 at 10 56 58 am

Most helpful comment

There is an update, _REMOTE_HOST_ is obsolete. SE_OPTS is the new one

docker run -d -p 5558:5555 -e SE_OPTS="-host 192.168.20.60 -port 4444" -e HUB_PORT_4444_TCP_ADDR="192.168.20.60" -e HUB_PORT_4444_TCP_PORT="4444" --name firefox selenium/node-firefox

All 13 comments

Is this on the host machine? if so then please use --link if hub and nodes are managed by the same docker service on the same host machine....

if hub runs on separate host and node on a diff machine you need to provide the public IP visible from the outside. The 172.21.x.x range looks like an internal subnet.

can you describe how you run those machines?

Hi @rubytester
The both machines are in local network, so that I put internal subnet ranged ip address,It can accessed from internal network, And I just exported the hub port & remote node ip addresses. It shows the node is connected to the hub, but the automation is not execute in those nodes which is remotely connected from the host. but I could run the same by using this https://github.com/elgalu/docker-selenium , why can't I run in https://github.com/SeleniumHQ/docker-selenium ?

Hi @viveksoundarrajan ,

Were you able to connect docker node image to remote hub image???

+1. Somebody knows how?

+1

+1
I'm having the exact same issue as described above..... thanks @viveksoundarrajan for sharing that other repository in the meantime... will give it a shot today.

+1

Alright guys I identified whats the issue, its even mentioned on the readme files however its not updated everywhere.

The issue is that Chrome crashes on docker version 1.10 and up, the workaround to this issue is to use the following arg/value in your nodes command: -v /dev/shm:/dev/shm

This is mentioned in the above repo mentioned by @viveksoundarrajan here: https://github.com/elgalu/docker-selenium#chrome-crashed

if your tests crashes in Chrome you may need to increase shm size or simply start your container by sharing -v /dev/shm:/dev/shm

This is also mentioned in the original selenium docker repo as well here: https://github.com/SeleniumHQ/docker-selenium#running-the-images

When executing docker run for an image with chrome browser please add volume mount -v /dev/shm:/dev/shm to use the host's shared memory.

$ docker run -d -p 4444:4444 -v /dev/shm:/dev/shm selenium/standalone-chrome:2.53.1

The reason why most people miss this from the documentation is that the original selenium docker repo only includes this in the standalone section and it does not include this information at the nodeschrome nor nodefirefox samples.......

It will be good if the readme is updated in a way that this is not missed anywhere.

so the way I'm using this with the original repo is as follow:

HUB

docker run -p 4444:4444 -d -P --name selenium-hub selenium/hub 

NODES

docker run -d -v /dev/shm:/dev/shm --link selenium-hub:hub selenium/node-chrome

Please give it a try :)

There is an update, _REMOTE_HOST_ is obsolete. SE_OPTS is the new one

docker run -d -p 5558:5555 -e SE_OPTS="-host 192.168.20.60 -port 4444" -e HUB_PORT_4444_TCP_ADDR="192.168.20.60" -e HUB_PORT_4444_TCP_PORT="4444" --name firefox selenium/node-firefox

thanks @unickq. closing. REMOTE_HOST might still be relevant for their version, but no activity for a while

Hi @ddavison .. Does it meant that the Firefox browser works without mount any volume?

it would technically work without mounting a volume, but we completely recommend mounting a volume because FF is a "hungry" browser like chrome is

Hi, @ddavison @carlosmmelo I am facing this issue in docker-compose version 3. Please check the below details and advise.

--- Chrome
INFO] Running Feature: Search by keyword
Jun 13, 2018 5:06:03 PM org.openqa.selenium.remote.DesiredCapabilities chrome
INFO: Using new ChromeOptions() is preferred to DesiredCapabilities.chrome()
?[31mGiven ?[0m?[31mI am Scientist?[0m ?[90m# EbiSearchScenarioSteps.i_am_Scientist()?[0m
?[31mnet.serenitybdd.core.exceptions.SerenityManagedException: http could not be reached

--- Firefox
INFO: Using new FirefoxOptions() is preferred to DesiredCapabilities.firefox()
?[31mGiven ?[0m?[31mI am Scientist?[0m ?[90m# EbiSearchScenarioSteps.i_am_Scientist()?[0m
?[31mnet.serenitybdd.core.exceptions.SerenityManagedException: http could not be reached

yaml file as follow

version: "3"
networks:

  • prodnetwork

driver: bridge

services:
selenium-hub:
image: selenium/hub
container_name: selenium-hub
networks:
- prodnetwork
ports:
- "4444:4444"
chrome:
image: selenium/node-chrome
depends_on:
- selenium-hub
volumes:
- browser_vol:/usr/src/browservolume
networks:
- prodnetwork
environment:
- HUB_HOST=selenium-hub
- HUB_PORT=4444
ports:
- "5910:5910"
firefox:
image: selenium/node-firefox
depends_on:
- selenium-hub
volumes:
- browser_vol:/usr/src/browservolume
networks:
- prodnetwork
environment:
- HUB_HOST=selenium-hub
- HUB_PORT=4444
ports:
- "5911:5911"
volumes:
browser_vol:

networks:
prodnetwork:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rosskevin picture rosskevin  路  5Comments

achung89 picture achung89  路  4Comments

testphreak picture testphreak  路  6Comments

minhnguyenvan95 picture minhnguyenvan95  路  5Comments

lluisteamcmp picture lluisteamcmp  路  6Comments