-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft: Create host directories when mounting container volumes #2705
base: main
Are you sure you want to change the base?
Conversation
Relying on Docker to create `hostpath` when adding the flag `-v hostpath:containerpath` is undocumented behavior and is not compatible with other containerization tools that people might use. Explicitly create the directories and refactor a bit.
This is not a review, I'm not part of this repository But it is documented here by docker: https://docs.docker.com/engine/reference/commandline/run/#volume
You can use https://github.com/actions/runner-container-hooks to customize how containers are managed by the actions/runner while keeping actions/runner unchanged. For example you have to already provide a symlink/wrapper or it wouldn't even try to use your unspecified container runtime. |
You are right 😅 Thanks for pointing this out. Creating directories is not supported by Podman however (by design), making the setup of self-hosted runners on any RHEL-derivative more painful. Podman is also rootless by default and is a much safer option for most self-hosted runners. This PR fixes the only annoying compatibility issue without introducing any breaking changes for Docker users (directories will still be created as usual)
You can just symlink I am not sure how this would be easier to implement in a |
Easier to maintain (as long this pr is not merged), you can keep runner auto updates enabled and you don't have to recompile the typescript code every month. Other way around you have 1 month time to recompile an actions/runner fork using You only need to write some lines for runner container hooks, a loop which does mkdir
Well this is another way, but container hooks don't need to parse cli parameters. They get structured data, again if you prefer python over nodejs then is python the more natural way to create a wrapper instead of a hook. Hooks use nodejs, because node is an existing runtime dependency. |
I've temporarily coded around this in the runner by overwriting the /usr/bin/docker script (installed by podman-docker, which internally calls podman) with a version that adds the relevant mkdir commands, though ideally each development team that uses rootless podman runners for enhanced security wouldn't have to independently discover and code around this issue. Creating the non-existent host directories beforehand as proposed by this PR seems like a reasonable solution that shouldn't cause issues with runners that use real Docker. The docker The podman project maintainers have declared their intent not to emulate |
Relying on Docker to create
hostpath
when using the flag-v hostpath:containerpath
is undocumented behavior andis not compatible with other containerization tools that people might want to use (even if they aren't explicitly supported).