-
Notifications
You must be signed in to change notification settings - Fork 868
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
[enhancement]: Add option to skip GrantContainerUserSUDOPrivilege in job container init #4332
Comments
Hi, @joshchngs thanks for reporting! |
Thanks for raising this issue, I think this whole block of code that interacts with and modifies the container needs discussion, it causes us no end of issues when running generic container images. I think more 'configuration knobs' to turn off the agent behaviour around creation, initialisation, and execution of containers, including this entire block of code would be a useful addition. The agent always mounting in the docker.socket (or all the bind mounts for that matter) should probably be optional too! |
This issue has had no activity in 180 days. Please comment if it is not actually stale |
@vmapetr I think your bot is throwing shade. Any progress? |
Any update on this. When can we have such feature? |
Describe your feature request here
I would like to be able to skip this section, per container definition:
azure-pipelines-agent/src/Agent.Worker/ContainerOperationProvider.cs
Lines 636 to 646 in 0b8aefd
If my image user already has sudo privilege, these steps are unnecessary. If I define the container with
--user <something>
they can't work. I want to be able to tell the agent that I've already handled setting up sudo for the job user.Why?
The documentation says that the container user must be able to run these commands. In reality, only root can do this, as
su
will prompt for a password otherwise. Therefore, it is only possible to use images with USER=root.Side note, I don't understand the
/etc/sudoers
write. This file should be read-only (mode 0440), and AFAIK it is in most base images. I don't understand how this command ever succeeds.There are a few use cases where USER=root is not possible, including mine. The highlighted
docker exec
s are the root cause, and are mentioned in a few places.Workarounds
The links above mention a few workarounds, such as passing
--user 0:0
as adocker create
option. This doesn't work for all use cases.I'm currently doing:
Dockerfile
su_hack.sh
Caveats
The use case enabled by adding the option is only viable if the image already has a correctly configured user with matching UID/GID for the container init step to find. This means that either the agent host user UID/GID needs to be controlled, or the image needs to be rebuilt on each agent before it's used.
The text was updated successfully, but these errors were encountered: