diff --git a/NodeBase/entry_point.sh b/NodeBase/entry_point.sh index a1e54a0137..b9797f26ce 100644 --- a/NodeBase/entry_point.sh +++ b/NodeBase/entry_point.sh @@ -6,6 +6,11 @@ if [ ! -e /opt/selenium/config.json ]; then exit 1 fi +if [ ! -z "$HUB_HOST" ]; then + echo "Connecting to the selenium hub using the host string ${HUB_HOST}" + HUB_PORT_4444_TCP_ADDR=$HUB_HOST +fi + if [ -z "$HUB_PORT_4444_TCP_ADDR" ]; then echo Not linked with a running Hub container 1>&2 exit 1 diff --git a/NodeChromeDebug/entry_point.sh b/NodeChromeDebug/entry_point.sh index 1fb7d07551..f66f871fd7 100644 --- a/NodeChromeDebug/entry_point.sh +++ b/NodeChromeDebug/entry_point.sh @@ -6,6 +6,11 @@ if [ ! -e /opt/selenium/config.json ]; then exit 1 fi +if [ ! -z "$HUB_HOST" ]; then + echo "Connecting to the selenium hub using the host string ${HUB_HOST}" + HUB_PORT_4444_TCP_ADDR=$HUB_HOST +fi + if [ -z "$HUB_PORT_4444_TCP_ADDR" ]; then echo Not linked with a running Hub container 1>&2 exit 1 diff --git a/NodeFirefoxDebug/entry_point.sh b/NodeFirefoxDebug/entry_point.sh index 1fb7d07551..f66f871fd7 100644 --- a/NodeFirefoxDebug/entry_point.sh +++ b/NodeFirefoxDebug/entry_point.sh @@ -6,6 +6,11 @@ if [ ! -e /opt/selenium/config.json ]; then exit 1 fi +if [ ! -z "$HUB_HOST" ]; then + echo "Connecting to the selenium hub using the host string ${HUB_HOST}" + HUB_PORT_4444_TCP_ADDR=$HUB_HOST +fi + if [ -z "$HUB_PORT_4444_TCP_ADDR" ]; then echo Not linked with a running Hub container 1>&2 exit 1 diff --git a/README.md b/README.md index ae2ef7044b..38e1d4289a 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,20 @@ $ docker run -d --link selenium-hub:hub selenium/node-chrome:2.48.2 $ docker run -d --link selenium-hub:hub selenium/node-firefox:2.48.2 ``` +### Hub and Nodes Using Docker Networking +``` bash +docker network create selenium-network +docker run -d -p 4444:4444 --net=selenium-network --name selenium-hub selenium/hub:2.48.2 +docker run -d --net=selenium-network -e HUB_HOST=selenium-hub selenium/node-chrome:2.48.2 +docker run -d --net=selenium-network -e HUB_HOST=selenium-hub selenium/node-firefox:2.48.2 +``` +You can also pass in an IP address, if your selenium hub is location on a different physical machine: +``` bash +docker run -d -e HUB_HOST=10.0.0.1:4444 selenium/node-chrome:2.48.2 +docker run -d -e HUB_HOST=10.0.0.1:4444 selenium/node-firefox:2.48.2 +``` + + ### JAVA_OPTS Java Environment Options You can pass `JAVA_OPTS` environment variable to java process.