atop is a tool I install on all my servers to go and check out what was happening on a machine when debugging site events. Is there a nice "docker" way to run atop in your fleet, or should I just get atop running in the os below docker?
Related to this is all the other tools I love having to debug issues: strace
, iotop
, htop
, tcpdump
, perf
, etc. What are people doing in production to cover this niche.
You can achieve this by running the container with --pid=host
(See the Docker Run Reference;
In certain cases you want your container to share the host’s process namespace, basically allowing processes within the container to see all of the processes on the system. For example, you could build a container with debugging tools like
strace
orgdb
, but want to use these tools when debugging processes within the container.
An example of a Dockerfile to run htop created by one of the Docker Maintainers can be found here; https://github.com/jfrazelle/dockerfiles/blob/master/htop/Dockerfile (and many more great examples in that repository). An automated build of that image can be found on Docker Hub here; https://hub.docker.com/r/jess/htop/
Run it like this;
docker run --rm -it --pid host jess/htop
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With