-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add rootless DinD runner #1644
Add rootless DinD runner #1644
Conversation
@some-natalie Hey! Thanks for your contribution. This looks awesome! Since you submited this pull request, I had been relearning how rootless dind is supposed to work. This does seem to remove the ability to run any privileged operations from within workflow jobs scheduled to be run within the runner pod's But |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing the index entry too
Hey @mumoshu, super sorry for the delay here! I was at a conference last week and am still digging out of my notifications.
Correct. However, if you want to run this with
Also correct! That's what this PR is hoping to do - add another layer of security within a privileged container. For some of the teams I work with (and my old team when I was running this in production), the limitations of the runner container approach wouldn't have been workable - many teams rely on the ability to have container Actions built from a dockerfile, for instance. For enterprise admins, balancing security, time investment in running CI, and user expectations that things "just work" in GHES like they did in GitHub.com is a really really hard thing to ask for, but this gives users one more option to consider. ❤️
Forgive the dumb question, @toast-gear , but what are you referring to here? Happy to revise, but not sure I understand what you're asking for. 😄 edit - 🤦🏻♀️ yeah, I see that now ... lemme know if this latest commit isn't what you were looking for. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we also want to update runner/Makefile to include actions-runner-dind-rootless build?
ca-certificates \ | ||
dnsutils \ | ||
ftp \ | ||
fuse-overlayfs \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had this PR tested on our self hosted runners infra in GKE. We found fuse-overlayfs not working very well on Ubuntu (super slow, deadlocking, etc.). Everything is working as expected when using default overlay filesystem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@isarkis, I think it's a bit out of scope for this PR - I superimposed my work on this topic from my demo repository onto this one for the PR. I don't run fuse-overlayfs
on my own images either, for much the same reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then, let's remove fuse-overlayfs from the runner/actions-runner-dind-rootless.dockerfile. Per https://docs.docker.com/engine/security/rootless/, overlay2, which is the default, is the recommended file system for Ubuntu.
@some-natalie, thank you so much for this PR, it will go long way to make self hosted runners workloads more secure. Does it also make sense to give ARC ability to use docker:dind-rootless when dockerdWithinRunnerContainer is set to false? |
I would say no, but that's not my call to make. First, some enterprises do not wish to allow container Actions at all for supply chain concerns and it's not my place to tell you how to run your business. No containers means no containers. Secondly, I tend to prefer explicit allows/denies over implicit "false, but true-ish" settings in software. Using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I managed to make it work with my test environment!
The only gotcha for me was that I had to use the docker
driver for docker-buildx when the buildx builder container is managed by the rootless docker. So, the relevant part of my Actions workflow definition now looks like:
- run: docker context create mycontext
- run: docker context use mycontext
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
buildkitd-flags: --debug
driver: docker
endpoint: mycontext
where in "rootful" it worked without driver: docker
.
The docker buildx driver doesn't support build cache export --cache-from/to
in docker-buildx-build args isn't valid anymore.
To be clear, all these gotchas are unrelated to this awesome rootless DinD runner feature!
So, this change LGTM.
Thank you so much for your contribution!
This is just an attempt for a friendly correction, but With With Honestly speaking, I don't know what might be the rationale if a person prefers a dockerdWithinRunnerContainer setting over another. Although it's not the default setting, probably
That said, @isarkis Do you have any need to use this feature with |
@mumoshu, there is no need to use this feature with I do have a problem with fuse-overlayfs being installed and used in the rootless runner container running Ubuntu. The default |
@mumoshu thank you for the clarification on @mumoshu and @isarkis - I'm happy to open a separate PR for removing @toast-gear - friendly bump on your review? ❤️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@some-natalie apologies for the delay, extremely busy at the moment.
@some-natalie Thanks for your confirmation! I'd prefer to merge this now so that we can state that this already works with a caveat(fuse is slow), and potentially involve more testers asap. I'd greatly appreciate it if you could submit a follow-up PR for the removal of Thank you again for your contribution 😄 |
Related to #1644 Signed-off-by: Yusuke Kuoka <[email protected]>
Related to #1644 Signed-off-by: Yusuke Kuoka <[email protected]> Signed-off-by: Yusuke Kuoka <[email protected]>
@some-natalie Hey! JFYI, I'm fixing an issue in the rootless startup script in #1856. |
@mumoshu thank you SO MUCH for the heads up and reminder here!!! |
Addresses, possibly closes #1288
Docker-in-Docker is great! While I was an enterprise admin, I just wanted GitHub Actions to work the way it does in .com for my users in GHES. However, rootful DinD raises some eyebrows to say the least. This PR adds a rootless DinD runner that does not allow
sudo
access.This mitigates some security concerns around nested virtualization, especially in a co-tenanted or enterprise-wide environment. However, it also means the administrator who builds these images on-premises needs to be responsible for every configuration that'd require sudo, such as installing new software with
apt-get
. On the other hand, this is much more "it just works" experience for users to build Docker images and otherwise use GitHub Actions on-premises. ❤️I wasn't sure how to add additional runner tests for this, but ran some tests manually on my own demo cluster and everything seems to work as anticipated so far. 😅
Running a docker build job, rootlessly:
Here's an example test workflow run in my own demo repo. I tested the following
runner
user.runner
user.sudo
failsThere's also a decent amount of debug info in that test as well.