4 ms·
I've done some initial investigation a while ago. You should be able to attach gdb to a process in a different cgroup. To more quickly edit configs just make i
by gravypod 7y ago
I've done some initial investigation a while ago. You should be able to attach gdb to a process in a different cgroup.
To more quickly edit configs just make it so your containers build and start quickly. This is very easy to do if you are aware of the docker layer cache.
Hot reload is basically `while (true) build() && restart()`
- geofft 7y agoOh, you can definitely attach gdb from outside the container to processes in the container. But I need to load debug symbols, libraries, etc. I'd like gdb to be able to see the source code I'm editing. I've done it and it doesn't quite work (I have stories about gdb's strange attempts at container-awareness... it spawns a thread and tries to stick that thread in the container so it can find files). Also, now your gdb setup isn't containerized, and that is genuinely part of your "dev environment" (it's a thing you want to share with other developers), so you lose out on many of the advantages of Dockerizing your dev environments. Note that you can't gdb/strace across containers because you can't see pids in one container from another container. (Similarly, a Kubernetes sidecar with gdb/strace isn't really going to work.) Not all of my software restarts quickly, and it's not because I don't know how to make containers do things - it's because the underlying build system is slow even on the local machine, or because they do a lot of processing at startup, or whatever. (Very few of the things I work on are webapps!)
- amazingman 7y ago> Note that you can't gdb/strace across containers because you can't see pids in one container from another container. (Similarly, a Kubernetes sidecar with gdb/strace isn't really going to work.) In Kubernetes, you can configure a Pod to share a single process namespace among its containers. https://kubernetes.io/docs/tasks/configure-pod-container/share-process-namespace/ https://kubernetes.io/docs/tasks/configure-pod-container/sha...
- geofft 7y agoWow, I totally missed this - good to know!
- akvadrako 7y agothere are solutions to your issues. One is sharing the namespaces. Another is putting gdb in your container (or a debug version) and bind mounting your build/dev directories