Start the runners as root
Closed this issue · 1 comments
I'm trying to use this wrapper script but the issue I'm having is that containers in github actions run as root so if you try to use this in combination with a workflow that requires containers then you'll get a permission error. I wanted to run this wrapper as root but there's a hardcoded useradd
which obviously conflicts with the existing root user.
Hi,
It's hard to maintain multi self-hosted runners under a same Linux user (such as root
), because:
- This wrapper app use user-level systemd service to manage multi self-hosted runners on a single Linux host.
- We need to isolate different runner environments as much as possible.
The sudo useradd
command in this wrapper actually create one Linux local user for one self-hosted runner on the VM, as well as set the new user in both runners
and docker
groups, where runners
group can run sudo
without password on the VM, and docker
group enables the Docker CLI permissions. That is, the runner users can execute both sudo blablabla
and docker blablabla
by default. If any runner was already created on the VM, you can type sudo su - <runner-user-name>
and then check those permissions.
Meanwhile, this script does not need to be executed by root
, but by a Linux user with no-password sudo permission, since all root
permission required operations were all decorated with sudo
with in this script.
For your needs - <Start the runners as root single user>, you can try these solutions:
- Directly add multi self-hosted runners under
root
on your VM, referring to official method. - Recommended: Modify the commands in your workflow files, decorate them with
sudo
ifroot
permission is required. This is also compatible with executing asroot
.
Hope these information works for you. 😄