-
-
Notifications
You must be signed in to change notification settings - Fork 118
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
Setcap immediately after building #128
Comments
I believe the capabilities are reset after the file is moved. At least, I think I've had that happen to me before. If the binary is moved after building it might need to be |
I have verified that using caddy and caddy-builder images from my PR at caddyserver/caddy-docker#274, I can:
Example
Build image: Open shell into resulting image: Verify capabilities:
So @mholt it should work fine to set capabilities via xcaddy! Not sure if there might need to be an |
See caddyserver/caddy-docker#274 (comment)
We're trying to see if we can make it easier to run Caddy as a non-root user for Docker. Using
setcap cap_net_bind_service=+eip
makes this easier, so that Caddy can bind to low ports (80/443).Making this change is super easy for the stock Caddy image, since we can just
setcap
on the vanilla Caddy binary when building the image, but when usingxcaddy
there's no good place to put the call tosetcap
such that it's out of the way of the user.So my thinking was we could have
xcaddy
do thesetcap
right after outputting the binary.I just noticed we already have
XCADDY_SETCAP=1
but it only applies when runningxcaddy
in dev mode. Can we expand this to also set it during build mode (if possible, fail quietly if it can't)?The text was updated successfully, but these errors were encountered: