Set up a local runner build infrastructure
You can define a CI build infrastructure on any Linux or macOS host.
You can configure CI build infrastructure on a Linux, macOS, or Windows host by installing a Harness Docker Delegate and local Harness Docker Runner. When the pipeline runs, the Harness Docker Runner runs the build actions in the environment where it is installed. The delegate handles communication between the Harness Platform and the Harness Docker Runner.
Local runner build infrastructure is recommended for small, limited builds, such as a one-off build on your local machine. Consider other build infrastructure options for builds-at-scale.
Set up a Linux local runner
Prepare machines
Review the following requirements for local runner build infrastructures:
There is a one-to-one relationship between Harness Docker Runners and Harness Delegates. If you need to run three local hosts, each host needs a runner and a delegate.
The Harness Docker Delegate is limited by the total amount of memory and CPU on the local host. Builds can fail if the host runs out of CPU or memory when running multiple builds. The Harness Docker Delegate has the following system requirements:
Default 0.5 CPU.
Default 1.5GB. Ensure that you provide the minimum memory for the delegate and enough memory for the host/node system.
The machine where the delegate runs must have Docker installed.
Install the delegate
Refer to the Delegate installation page.
Copy the delegate install command and modify it as follows:
Add
--net=hostto the first line.Add
-e DELEGATE_TAGS="DELEGATE_OS_ARCH", and replaceDELEGATE_OS_ARCHwith the tag corresponding to your Docker environment's architecture:linux-amd64orlinux-arm64.
Run the modified install command on your build host machine.
Install the Harness Docker Runner
The Harness Docker Runner service performs the build work. The delegate needs the runner to run CI builds.
Download a Harness Docker Runner executable corresponding to your build farm's OS and architecture.
(Optional) To use self-signed certificates, export
CI_MOUNT_VOLUMESalong with a comma-separated list of source paths and destination paths formatted aspath/to/source;path/to/destination:(Optional) To run the Docker Runner as a non-root user, set the
WORKING_DIRenvironment variable before starting the runner. This ensures all files are created inside the specified directory only:For example:
Enable execution permissions for the Runner, for example:
Start the runner binary, for example:
Define build infrastructure
After configuring the host machine, you need to set the pipeline's build infrastructure.
Set up a macOS local runner
Prepare machines
Review the following requirements for local runner build infrastructures:
There is a one-to-one relationship between Harness Docker Runners and Harness Delegates. If you need to run three local hosts, each host needs a runner and a delegate.
The Harness Docker Delegate is limited by the total amount of memory and CPU on the local host. Builds can fail if the host runs out of CPU or memory when running multiple builds. The Harness Docker Delegate has the following system requirements:
Default 0.5 CPU.
Default 1.5GB. Ensure that you provide the minimum memory for the delegate and enough memory for the host/node system.
The machine where the delegate runs must have Docker installed.
Install the delegate
Refer to the Delegate installation page.
Copy the delegate install command and modify it as follows:
Add
-e DELEGATE_TAGS="DELEGATE_OS_ARCH", and replaceDELEGATE_OS_ARCHwith the tag corresponding to your Docker environment's architecture:macos-amd64ormacos-arm64.Add
-e RUNNER_URL=http://host.docker.internal:3000.
Run the modified install command on your build host machine.
Install the Harness Docker Runner
The Harness Docker Runner service performs the build work. The delegate needs the runner to run CI builds.
Download a Harness Docker Runner executable corresponding to your build farm's OS and architecture.
(Optional) To use self-signed certificates, export
CI_MOUNT_VOLUMESalong with a comma-separated list of source paths and destination paths formatted aspath/to/source;path/to/destination:(Optional) To run the Docker Runner with a custom working directory, set the
WORKING_DIRenvironment variable before starting the runner. This ensures all files are created inside the specified directory only:For example:
Enable execution permissions for the Runner, for example:
Start the runner binary, for example:
If macOS Gatekeeper stops the installation because it can't check for malicious software, you need to modify Security & Privacy settings to allow this app to run.

macOS Gatekeeper error message.
Define build infrastructure
After configuring the host machine, you need to set the pipeline's build infrastructure.
Set up a Windows local runner
Prepare machines
Review the following requirements for Windows local runner build infrastructures:
You need two machines for each build host:
A Windows machine where the Harness Docker Runner will run. This machine must have Docker for Windows installed. The Harness Docker Runner runs as an executable.
A Linux or macOS machine where the Harness Delegate will run. This machine must have Docker installed. The delegate runs as a container.
There is a one-to-one relationship between Harness Docker Runners and Harness Delegates. If you need to run three local hosts, each host needs a runner machine and a delegate machine.
The Harness Docker Delegate is limited by the total amount of memory and CPU on the local host. Builds can fail if the host runs out of CPU or memory when running multiple builds. The Harness Docker Delegate has the following system requirements:
Default 0.5 CPU.
Default 1.5GB. Ensure that you provide the minimum memory for the delegate and enough memory for the host/node system.
Install the delegate
Refer to the Delegate installation page.
Copy the delegate install command and modify it as follows:
Add
-e DELEGATE_TAGS="windows-amd64".Add
-e RUNNER_URL=http://WINDOWS_MACHINE_HOSTNAME_OR_IP:3000.
The
RUNNER_URLmust point to the Windows machine where the Harness Docker Runner will run.Run the modified install command on the Linux or macOS machine where you want to run the delegate.
Install the Harness Docker Runner
The Harness Docker Runner performs the build work. The delegate needs the runner to run CI builds.
On Windows platforms, you can install the Docker Runner as a process (using a .exe) or a service (using a .msi). The advantage to installing the Docker Runner as a service is that the service automatically starts when the runner machine restarts.
Install the Harness Docker Runner on the Windows machine that you specified in the delegate's RUNNER_URL.
Download the Windows Harness Docker Runner executable on the Windows machine where you want to run the Harness Docker Runner. This should be the Windows machine that you specified in the delegate's
RUNNER_URL.Use PowerShell to run these commands. Open a terminal with Administrator privileges.
(Optional) To use self-signed certificates, set
CI_MOUNT_VOLUMESalong with a comma-separated list of source paths and destination paths formatted aspath/to/source;path/to/destination, for example:(Optional) To run the Docker Runner with a custom working directory, set the
WORKING_DIRenvironment variable before starting the runner. This ensures all files are created inside the specified directory only:For example:
Start the runner binary:
The advantage to installing the Docker Runner as a Windows service is that the service restarts when the runner machine restarts. This can be helpful if your workflow requires the runner machine to restart on a schedule or after certain events.
Download the Windows Harness Docker Runner MSI file (
harness-docker-runner-svc.msi) on the Windows machine where you want to run the Harness Docker Runner. This should be the machine that you specified in the delegate'sRUNNER_URL.Launch the downloaded
harness-docker-runner-svc.msifile to start the installation process. Then accept the license, select Next, and finish the installation.(Optional) To test the service availability, open a terminal with Administrator privileges and run:
Windows Docker Runner service logs are located at C:\Windows\system32\harness-docker-runner-TIMESTAMP.log. If your Windows installation doesn't use the default C:\Windows\system32 file path, you can find the log files at INSTALL_DIRECTORY\harness-docker-runner-TIMESTAMP.log.
Don't manually start, stop, or delete the Runner service. This can cause problems with orphaned files or subprocesses.
If you need to remove the service, follow the uninstall instructions in the Windows Harness Docker Runner MSI Readme.
Define build infrastructure
After configuring the host machines, you need to set the pipeline's build infrastructure.
Set the pipeline's build infrastructure
Edit the CI pipeline where you want to use the local runner build infrastructure.
In the pipeline's Build stage, select the Infrastructure tab.
Select Local for the Infrastructure.
Select the relevant Operating System and Architecture.
Save your pipeline.
In the pipeline's build stage (type: CI), insert platform and runtime specifications, for example:
platform:os: SpecifyLinux,MacOS, orWindowsarch: SpecifyAmd64orArm64
runtime:type:Dockerspec:{}
Override Image Connector
By default, Harness pulls certain images from public Docker Hub repos that are needed to run a build. You can override this by using a Docker connector that downloads the images from the Harness Container Image Registry instead. This option is useful when your default Delegate cannot access the public registry (for example, due to security policies in your organization or if your infrastructure is running in a private cloud).
How It Works
Refer to the YAML snippet below to see how this is used. Harness Docker Runner would use the referenced Docker connector to authenticate and pull CI images.
You can make custom CA certificates available inside all build step containers (including the drone/git clone container) on Windows build VMs by setting the DRONE_RUNNER_VOLUMES environment variable when starting the VM runner.
Example
Notes
The certificate file inside
/custom-certmust be namedca-bundle.crt.The
drone-gitcontainer on Windows expects the certificate to be available atC:\git\mingw64\ssl\certs\ca-bundle.crt.The
DRONE_RUNNER_VOLUMESpath must use Linux-style syntax — use/as the path separator and omit the drive letter (C:), even though the build VM runs Windows.
Troubleshoot local runner build infrastructure
Go to the CI Knowledge Base for questions and issues related to using a local runner build infrastructure, such as:
Last updated
Was this helpful?
