News for hackers. Stuff that matters.
Re:Minify your container by U1F984 on Wednesday August 03, 2022 @05:44PM (#32336957)
For Go you can use FROM scratch and save a couple more megabytes.
Re:Minify your container by lrvick on Wednesday August 03, 2022 @06:18PM (#32337233)
This works on any language. I only use scratch in prod. Even for nodejs or python... compile a static interpreter binary and truck on.

Dev tools like bash, ls, grep, etc, have no place in production and only increase attack surface.

Re:Minify your container by nijave on Wednesday August 03, 2022 @09:31PM (#32338381)
How do non running utilities increase attack surface? If you're able to execute inside the container couldn't you just write whatever utilities you want in?
Re:Minify your container by lrvick on Wednesday August 03, 2022 @10:18PM (#32338603)
There are many exploits that may give one the ability to execute shell commands. If there is no shell or commands to even write a file in the first place, mobility becomes limited.
Re:Minify your container by CameronNemo on Thursday August 04, 2022 @08:14PM (#32349977)
Most container workloads I have use a read only root fs.
Re:Minify your container by 8n4vidtmkvmk on Thursday August 04, 2022 @02:31AM (#32339831)
once in awhile i use 'kubectl exec ' to run some commands against my running prod containers to debug something or extract an environment variable. can i still do that without a shell or anything?
Re:Minify your container by dmart on Thursday August 04, 2022 @03:19AM (#32340134)
k8s has first-class support for ephemeral debug containers that share process namespaces for this purpose. Pretty cool feature imo.

https://kubernetes.io/docs/tasks/debug/debug-application/deb...

Re:Minify your container by hdjrudni on Thursday August 04, 2022 @11:05PM (#32351070)
That sounds sweet! But I guess DigitalOcean doesn't support it? I'm getting "error: ephemeral containers are disabled for this cluster (error from server: "the server could not find the requested resource")."
Re:Minify your container by cmckn on Thursday August 04, 2022 @02:54AM (#32339977)
You can’t, no. One approach is a “debug sidecar” container in the Pod that has your desired tools. Linkerd, for example, will add such a container if an annotation is present on the Pod: https://linkerd.io/2.11/tasks/using-the-debug-container/

I usually just include a shell, but to each their own.

Re:Minify your container by iruoy on Wednesday August 03, 2022 @08:02PM (#32337859)
You'll need to make sure that the binary is statically linked though.