-
Notifications
You must be signed in to change notification settings - Fork 158
docker: switch base image from distroless/base to distroless/static:nonroot #224
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
Conversation
…onroot go-httpbin is built fully statically and does not depend on libc, so it can use the distroless/static image. This change reduces the resulting image size by about half. Since go-httpbin's default listening port is 8080, an unprivileged port, it can run as non-root. While this may break setups that use privileged ports, running as non-root provides a clear security advantage. Such users can continue using their ports by adding the CAP_NET_BIND_SERVICE capability. Signed-off-by: Kohei YOSHIDA <kohei@yosida95.com>
|
Oh I like this, thank you!
Would you mind adding this note to the README under the docker instructions? Thanks! |
Signed-off-by: Kohei YOSHIDA <kohei@yosida95.com>
Signed-off-by: Kohei YOSHIDA <kohei@yosida95.com>
|
@mccutchen I've updated the README and the Kubernetes manifest as well. Could you please take a look? Thanks! |
|
This looks great, thanks! I love the thoroughness of the README update, but I might actually push a small commit to link out to documentation on CAP_NET_BIND_SERVICE to keep it brief, given that this is unlikely — I assume — to be a common need. (Also, I'll fix the test failure separately.) |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #224 +/- ##
=======================================
Coverage 95.12% 95.12%
=======================================
Files 10 10
Lines 1827 1827
=======================================
Hits 1738 1738
Misses 52 52
Partials 37 37 🚀 New features to boost your workflow:
|
On second thought, I kept the more detailed info but moved it down below. I hope you don't mind! Thanks a lot for the contribution, this is a nice little improvement to both image size and out-of-the-box security posture. |
go-httpbin is built fully statically and does not depend on libc, so it can use the distroless/static image. This change reduces the resulting image size by about half.
Since go-httpbin's default listening port is 8080, an unprivileged port, it can run as non-root. While this may break setups that use privileged ports, running as non-root provides a clear security advantage. Such users can continue using their ports by adding the CAP_NET_BIND_SERVICE capability.