How to initiate new container at runtime in Docker?

Hi All,

I’m actually executing scripts on docker and i use docker compose to start hub and node. And let say i start 5 chrome node and execute script on 5 node but there is some testcases which requires 2 or 3 browser , so i want to scale the chrome node at runtime. I can scale up or scale down the chrome node as per my testcase at runtime or if possible, can it be done thru java?

Pls help how can i scale the node at runtime.

1 Like

You can use the Docker scale command to do the same.


Note: This is a cluster management command, and must be executed on a swarm manager node.

Please refer this official doc to learn how to scale the service in the swarm

1 Like

What if i want to scale service through java and number of replicas is not known and has to be decided at runtime as per requirements?

For the first question, please clarify that are you looking for just the command or complete guide for Docker with Java?

For the second question, you can pass the factor as parameter, based on the requirements.


Could you help me how can i scale service through java code.