You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make the host path for container-job externals configurable
Issue
When a self-hosted runner launches container jobs through the host Docker daemon,
the daemon resolves bind-mount source paths on the host, not inside the runner container.
The runner currently uses its own externals install path as that source,
which can require the host to expose it at the fixed path /actions-runner/externals.
Which is awkward for containerized runner deployments and environments where the
host filesystem layout is managed separately.
Solution
I’ve implemented an optional RUNNER_EXTERNALS_HOST_PATH environment variable to allow
operators specify the absolute host-visible path containing the runner’s externals directory.
The runner uses that path as the mount source while keeping the existing /__e destination inside the job container.
If the variable is unset, the behavior is unchanged and invalid paths are rejected with an actionable error.
This removes the fixed host-path requirement without changing how actions find their Node.js
runtimes inside job containers.
The path still needs to be available at the same absolute location to both the runner
container and the Docker daemon.
Why
I have a problem messing with the root of the file system of the host.
It should not be needed that it requires /actions-runner/externals to be at that fixed
location and even in the root only.
In my project for building the Docker image, testing and publishing I
even use fuse-zip to mount an externals.zip on /tmp/runner-externals to get the path /tmp/runner-externals/externals which is passed using the RUNNER_EXTERNALS_HOST_PATH variable.
See the build.sh script.
Note: The externals.zip is extracted from the runner image by overriding the entrypoint script
with the build.sh script by simply checking for file /.dockerenv.
The script and its repository are only for building, testing and publishing the custom GitHub Actions
runner image.
Usage: build.sh [--help] <command> [arguments]
Build, publish, and operate the custom GitHub Actions runner image.
Image: amd64/github-runner:2.338.0
Commands:
clean Remove runner build outputs and the _layout, _dotnetsdk and _downloads directories
runner Builds/assembles actions-runner binaries and files for the image in the '_layout' directory by
passing the arguments to 'dev.sh' script which allows to use 3 arguments:
1: Command build(b), test(t), layout(l), package(p), or format(f)
2: Built type 'Release' or 'Debug' as second argument.
3: Platform 'linux-64' or 'linux-x86' or 'linux-arm64'.
Defaults to 'layout Release linux-x64'
image Build the Docker image and tag it for the private registry.
imagex Build with Docker 'buildx' and load it locally.
zip-file Creates a zip-file in directory '/tmp' when it does not exist yet.
zip-mount Fuse mount the externals directory.
zip-umount Fuse unmount the externals directory.
run Run the organization runner in the foreground (stops after one job).
start Start the organization runner in the background.
remove Removes a container started with 'start'.
stop Stop the named runner container.
kill Kill the named runner container.
status Show the named runner container.
attach Open a Bash shell in the runner container.
exec Execute a command in the container using a bash shell.
push Push the image to the private registry.
pull Pull the image from the private registry.
docker-push Push the versioned image to Docker Hub.
docker-latest Push the image to Docker Hub with the latest tag.
Combi-commands:
build-image Execute command runner and image sequentially.
do-run Executes zip-file, zip-mount and finally run in a loop.
do-start Executes zip-file, zip-mount and start for background operation.
do-status Executes status command in a loop.
Runner settings are read from .credentials. Required runner values:
GITHUB_PAT, GITHUB_ORG, GITHUB_RUNNER_NAME
Optional values:
RUNNER_LABELS (defaults to 'sf-build')
Registry settings:
NEXUS_REPOSITORY (private registry), DOCKER_USER (Docker Hub)
Examples:
Build runner only:
./build.sh runner build Release linux-x64
From scratch:
./build.sh runner
./build.sh image
./build.sh push
./build.sh zip-file
./build.sh zip-mount
./build.sh start
Clone & Try it Out !!
The script and its repository are only for building, testing and publishing the custom GitHub Actions
runner image.
ActionsBuild, test, and automate your deployment pipeline with world-class CI/CDQuestionAsk and answer questions about GitHub features and usageActions RunnerFor issues and discussions related to the Actions Runner projectWelcome 🎉Used to greet and highlight first-time discussion participants. Welcome to the community!source:uiDiscussions created via Community GitHub templates
1 participant
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
🏷️ Discussion Type
Question
💬 Feature/Topic Area
Actions Runner
Discussion Details
Make the host path for container-job
externalsconfigurableIssue
When a self-hosted runner launches container jobs through the host Docker daemon,
the daemon resolves bind-mount source paths on the host, not inside the runner container.
The runner currently uses its own externals install path as that source,
which can require the host to expose it at the fixed path
/actions-runner/externals.Which is awkward for containerized runner deployments and environments where the
host filesystem layout is managed separately.
Solution
I’ve implemented an optional
RUNNER_EXTERNALS_HOST_PATHenvironment variable to allowoperators specify the absolute host-visible path containing the runner’s
externalsdirectory.The runner uses that path as the mount source while keeping the existing
/__edestination inside the job container.If the variable is unset, the behavior is unchanged and invalid paths are rejected with an actionable error.
This removes the fixed host-path requirement without changing how actions find their Node.js
runtimes inside job containers.
The path still needs to be available at the same absolute location to both the runner
container and the Docker daemon.
Why
I have a problem messing with the root of the file system of the host.
It should not be needed that it requires
/actions-runner/externalsto be at that fixedlocation and even in the root only.
In my project for building the Docker image, testing and publishing I
even use
fuse-zipto mount anexternals.zipon/tmp/runner-externalsto get the path/tmp/runner-externals/externalswhich is passed using theRUNNER_EXTERNALS_HOST_PATHvariable.See the build.sh script.
Question
Would this be useful for a runner configuration?
References
externals-via-envBuild Script Help
The script and its repository are only for building, testing and publishing the custom GitHub Actions
runner image.
Clone & Try it Out !!
The script and its repository are only for building, testing and publishing the custom GitHub Actions
runner image.
All reactions