A containerized solution for managing GitHub Actions self-hosted runners. This project provides a Docker-based setup for running GitHub Actions runners in containers, with support for Docker-in-Docker capabilities and additional development tools.
- Containerized GitHub Actions runner setup
- Docker-in-Docker support
- Pre-installed development tools:
- AWS CLI
- Terraform
- Packer
- Python with pip
- Git
- SSH client
- Automatic runner cleanup on container termination
- Configurable runner naming based on hostname
- Docker
- Docker Compose
- GitHub Personal Access Token with appropriate permissions
- GitHub organization or repository where you want to register the runner
-
Clone this repository:
git clone <repository-url> cd launch-runners
-
Configure the environment variables in
compose.yml
:services: runner: environment: - OWNER=your-github-org-or-username - ACCESS_TOKEN=your-github-token
-
Build and start the runner:
docker compose up -d
OWNER
: Your GitHub organization name or usernameACCESS_TOKEN
: GitHub Personal Access Token withadmin:org
orrepo
scopeRUNNER_NAME
: (Optional) Custom name for the runner (defaults tobbrunner-${HOSTNAME}
)
The runner container mounts the Docker socket to enable Docker-in-Docker capabilities:
volumes:
- /var/run/docker.sock:/var/run/docker.sock
The start.sh
script handles:
- Runner registration
- Automatic cleanup on container termination
- Signal handling for graceful shutdown
Use the delete-runners.sh
script to remove offline runners:
- Configure the script with your repository and token:
REPO="your-org/repo" TOKEN="your-github-token"
- Run the script:
./delete-runners.sh
- The GitHub token should have minimal required permissions
- The runner runs as a non-root user inside the container
- Docker socket mounting should be used with caution in production environments
The container comes with several pre-installed tools:
- AWS CLI v2
- Terraform v1.8.5
- Packer v1.8.5
- Python 3 with pip
- Git
- Docker
- SSH client
- Additional development dependencies