Customizing maxInstances for a Selenium Docker node

865 views
Skip to first unread message

Jeff H.

unread,
Aug 28, 2015, 2:05:06 AM8/28/15
to Selenium Users
I'm relatively new to Docker, but have successfully been able to get a Selenium Grid hub and nodes up-and-running using images from Docker Hub.

With each of the nodes that I've started (one each for Chrome and Firefox), a single WebDriver instance is created, which makes sense based on what I see in the relevant config.json files.  Example:


...which contains:


 
{
 
"browserName": "firefox",
 
"maxInstances": 1,
 
"seleniumProtocol": "WebDriver"
 
}


I'm trying to figure out if there is a way to override the maxInstances value when I run the Docker container, so that (for example) I can start five instances instead of one.

I know that with the Selenium hub, it's possible to pass command-line arguments with a syntax like this:
docker run -d -P --name selenium-hub -e GRID_TIMEOUT=10000 selenium/hub

Does anyone know if there is a similar capability to pass command-line arguments to the Selenium node as part of the docker run command? 

Krishnan Mahadevan

unread,
Aug 31, 2015, 9:56:08 AM8/31/15
to seleniu...@googlegroups.com
Jeff,

I also don’t have much of an expertise around Docker. But here’s what I have managed to figure out so far.

The reason why you are able to pass in command-line arguments to the Hub is because the DockerFile has exposed that capability, which unfortunately isn’t available for the nodes.

So it looks like for you to be able to get this capability, you may have to basically introduce this capability and either choose to contribute this back to the codebase or decide to build things locally. 

You can refer to the below links :


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Technical Scribbings @ http://rationaleemotions.wordpress.com/



--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/b5d9d09a-5072-43a7-9f62-33847634d73d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jeff H.

unread,
Aug 31, 2015, 12:11:50 PM8/31/15
to Selenium Users
Thanks Krishnan! I came to the same conclusion after digging into this a little more, and will see if I can get what I need from building a local Docker image sourced from the docker-selenium GitHub project.

Cheers,

Jeff

Jeff H.

unread,
Sep 1, 2015, 6:47:45 PM9/1/15
to Selenium Users
The workflow of cloning the docker-selenium GitHub project and building it locally worked as expected.  In case anyone else might benefit from the results, they are on Docker Hub:

Cheers,

Jeff

Krishnan Mahadevan

unread,
Sep 1, 2015, 11:11:10 PM9/1/15
to seleniu...@googlegroups.com
Jeff,
Did you send out a Pull Request as well to accommodate the ability to specify instances ? That way everyone can stand benefitted. One of the things I noticed is that the DockerImages for the nodes seem to be restricting a lot of the capabilities that the bare node provides viz., specifying max instances, specifying a custom proxy to be used for registration, ability to plug in one or more servlets at the node level etc.,

Jeff Hall

unread,
Sep 2, 2015, 11:48:47 AM9/2/15
to seleniu...@googlegroups.com
Good idea Krishnan!  The pull request has been submitted:


Cheers,

Jeff


You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/iKt6QyiZHLY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to selenium-user...@googlegroups.com.

To post to this group, send email to seleniu...@googlegroups.com.

Mark Collin

unread,
Sep 3, 2015, 4:47:12 AM9/3/15
to Selenium Users
The Docker mindset is 1 container for 1 thing.

If you want 5 chrome nodes just start 5 instances of the chrome node container.


On Wednesday, 2 September 2015 16:48:47 UTC+1, Jeff H. wrote:
Good idea Krishnan!  The pull request has been submitted:


Cheers,

Jeff

To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.

-- 
You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/iKt6QyiZHLY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.

krishnan.ma...@gmail.com

unread,
Sep 3, 2015, 4:54:08 AM9/3/15
to seleniu...@googlegroups.com

Mark

Can you please elaborate. I didnt quite understand.

-Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else"




Mark Collin

unread,
Sep 3, 2015, 5:26:10 AM9/3/15
to Selenium Users
Each container should be a single process that does one thing.

If you want a selenium grid with 5 chrome nodes attached to it start up a grid container and then start up 5 more chrome node containers.  You'll then have a total of 6 containers, one running the grid and 5 running chromedriver.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.

To post to this group, send email to selenium-users@googlegroups.com.

Krishnan Mahadevan

unread,
Sep 3, 2015, 8:04:31 AM9/3/15
to seleniu...@googlegroups.com
Ah ok! I wasn’t aware of that. I was imagining this to be more of something like a VM image which contains a pre-configured grid/node setup. That was why I was thinking that perhaps we can fiddle around with the config.json and have it support more than one instance of a browser.

Thanks for clarifying this Mark.



Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

Mark Collin

unread,
Sep 3, 2015, 9:47:33 AM9/3/15
to Selenium Users
Have a look at:


In practise lots of people don't create containers that only do one thing (The selenium grid node images are a case in point, they run multiple processes t get a node running in a container), but they really should try to.  

A good read is Jessie Frazelle's blog she has lots of awesome images that do it properly (Not surprising since she's one of the core Docker devs).  The chrome image is cool, notice the use of X sockets so that she doesn't have to install an X server in the container.

...
Reply all
Reply to author
Forward
0 new messages