Running Several Incredibuild Containers on One Host Machine

You can launch and run several Incredibuild containers on one host machine. This is useful, for example, if you have a host machine with a large number of cores, and you want to run on it several containerized Helper Agents that will serve different Initiators. 

Note: To connect different containerized Helper Agents from one machine to different Initiators,see Working with Build Groups.

Launching several Incredibuild containers on one host machine, is done in the same way you would launch one Incredibuild container. After one container is launched using the docker run command, repeat the procedure and use the docker run command again on the same host machine.

Note: The docker run command allows you to launch one container at a time. If you want to launch several containers simultaneously, you need to use a Docker container management tool.

The one thing you need to change when launching several Incredibuild containers on one host machine, is to map the Agent ports of each container to different physical ports on the host machine. If you will use the same host machine ports for more than one container, the communication with one containerized Agent will block the communications with the other containerized Agents.

If, for example, you map the ports of one container to ports 31105 (BuildService) and 31106-31109 (BuildHelper) on the host machine, do not map the ports of another container to these ports on the host machine. Use other available ports on the host machine for the mapping, such as 41105, and 41106-41109.

> To launch and run several Incredibuild containers on one host machine:

  1. Launch one Incredibuild container using the docker run command, according to the instructions on Launching a Container Based on Incredibuild Docker Image.

  2. Once the first container is running, launch another Incredibuild container using the docker run command. When setting the docker run command, verify the following:

    • --cpus – enter a maximum number of cores for the new containerized Agent based on the number of available cores of the host machine, and the number of cores used by the other Agent.

    • -p <Host_Machine_Port_No._mapped_to:BuildService_Port_No._in_the_Container>/tcp – enter a different port no. for the host machine than the one used by the running containerized Agent.

    • -p <Host_Machine_Port_Range_mapped_to:BuildHelper_Port_Range_in_the_Container>/tcp – enter a different port range for the host machine than the one used by the running containerized Agent. Port ranges on the host machine and the container that are mapped to each other must match. Therefore, if you change the port range of the host machine, you must also change the port range of the container.

  3. To launch additional containerized Agents, repeat Step 2 above.

In the following example, two Incredibuild containers were launched on one host machine.

For one container, the following docker run command was entered:

Copy
docker run --cpus 4 
-e Coordinator=IncrediBuild1 
-e CoordinatorPort=31104 
-e BuildServicePort=31105 
-e BuildHelperPort=31106 
-it 
-p 31105:31105/tcp 
-p 31106-31109:31106-31109/tcp 
incredibuild:9.5.0

For the other container, in the docker run command a different port mapping on the host machine was entered:

Copy
docker run --cpus 4 
-e Coordinator= IncrediBuild1 
-e CoordinatorPort=31104 
-e BuildServicePort=41105 
-e BuildHelperPort=41106 
-it 
-p 41105:41105/tcp 
-p 41006-41109:41106-41109/tcp 
incredibuild:9.5.0

The two active containerized Agents are displayed in the Coordinator Monitor: