CircleCI Self-hosted Runner Installation with Docker
On This Page
This page describes how to install CircleCI self-hosted runner with Docker.
|This page is a continuation of installing self-hosted runners. You will need to have an existing namespace and resource class to continue below. You can do this on the CircleCI web app by navigating to Self-Hosted Runners (see the documentation for the Web App Installation). You can also use the CLI.|
The host needs to have Docker installed. Once the
runner container is started, the container will immediately attempt to start running jobs. The container will be reused to run more jobs indefinitely until it is stopped.
The number of containers running in parallel on the host is constrained by the host’s available resources and your jobs' performance requirements.
Create a Dockerfile that extends the CircleCI self-hosted runner image
Dockerfile.runner.extended file. In this example, Python 3 is installed on top of the base image.
FROM circleci/runner:launch-agent RUN sudo apt-get update; \ sudo apt-get install --no-install-recommends -y \ python3
Build the Docker image
docker build --file ./Dockerfile.runner.extended .
Start the Docker container
| The environment variable values are not available to the |
CIRCLECI_RESOURCE_CLASS=<resource-class> CIRCLECI_API_TOKEN=<runner-token> docker run --env CIRCLECI_API_TOKEN --env CIRCLECI_RESOURCE_CLASS --name <container-name> <image-id-from-previous-step>
When the container starts, it will immediately attempt to start running jobs.
Start the Docker container on server
When starting the docker container on server, the
LAUNCH_AGENT_API_URL environment variables will need to be passed in using the
CIRCLECI_RESOURCE_CLASS=<resource-class> CIRCLECI_API_TOKEN=<runner-token> agent_version=<agent_version_for_server> LAUNCH_AGENT_API_URL=<server_host_name> docker run --env agent_version --env LAUNCH_AGENT_API_URL --env CIRCLECI_API_TOKEN --env CIRCLECI_RESOURCE_CLASS --name <container-name> <image-id-from-previous-step>
Stopping the Docker container
docker stop <container-name>
Remove the Docker container
In some cases you might need to fully remove a stopped self-hosted runner container from the system, such as when recreating a container using the same name.
docker stop <container-name>; docker rm <container-name>;
Help make this document better
This guide, as well as the rest of our docs, are open source and available on GitHub. We welcome your contributions.
- Suggest an edit to this page (please read the contributing guidefirst).
- To report a problem in the documentation, or to submit feedback and comments, please open an issue on GitHub.
- CircleCI is always seeking ways to improve your experience with our platform. If you would like to share feedback, please join our research community.
Our support engineers are available to help with service issues, billing, or account related questions, and can help troubleshoot build configurations. Contact our support engineers by opening a ticket.
You can also visit our support site to find support articles, community forums, and training resources.
CircleCI Documentation by CircleCI is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.