News for hackers. Stuff that matters.
Re:`COPY –chmod` reduced the size of my container image by 35% by madduci on Saturday March 26, 2022 @07:44AM (#30811021)
While this is the go-to approach, I find really hard later to debug problems for images who don't have even an shell or a minimum set of tools to help debug a problem
Re:`COPY –chmod` reduced the size of my container image by 35% by atombender on Saturday March 26, 2022 @11:27AM (#30812656)
I recommend avoiding this kind of thinking, which leads to bundling all sorts of stuff in every single container. My philosophy is that images should contain as little as possible.

To debug a container, a better way is to enter the container's kernel namespaces using a tool such as nsenter [1]. Then you can use all your favourite tools, but still access the container as if you're inside it. Of course, this means accessing it on the same host that it's running.

If you're on Kubernetes, debug containers [2] are currently in beta, and should be much nicer to work with, as you can do just "kubectl debug" to start working with an existing pod.

[1] https://man7.org/linux/man-pages/man1/nsenter.1.html

[2] https://kubernetes.io/docs/tasks/debug-application-cluster/d...

Re:`COPY –chmod` reduced the size of my container image by 35% by sokoloff on Saturday March 26, 2022 @10:06AM (#30811884)
Related, is there any built-in facility that would log file system accesses that failed on the resulting image? Seems like that would give the answer in a substantial fraction of cases.
Re:`COPY –chmod` reduced the size of my container image by 35% by bigpod on Saturday March 26, 2022 @08:24AM (#30811252)
you can use --include-shell to inclue a shell. but my recommendation is always keep a non-slimmed image somewhere so you can refer to it and some debugging can be done in either, also that allows you to use something like slim.ai's(company behind docker-slim) web based SaaS features which allow you to see the differences between 2 images and see the file system in nice web base file tree. some bugs may stem from removing what is necessary for app to work(sometimes caused by not loading a library during "slimming" process) for those types of errors you need to know how your app runs more then anything. it a tradeoff
Re:`COPY –chmod` reduced the size of my container image by 35% by madduci on Sunday March 27, 2022 @06:39AM (#30819224)
The problem is that sometimes, using commands like cp don't output the error in case of failed permissions and if there's any tool into it (e.g. ls), you can't find out why it fails