Interview Prep/Docker/Operations, Rootless & Podman

How do you investigate high CPU or memory use of a specific container?

IntermediateProductionOperations, Rootless & Podman
Answer
docker stats --no-stream
docker top app -eo pid,ppid,pcpu,pmem,cmd
PID=$(docker inspect -f '{{.State.Pid}}' app); sudo nsenter -t $PID -p -m top
sudo perf top -p $PID

Then use language profilers (async-profiler, py-spy dump --pid, pprof). Check throttling in cpu.stat too.

All Docker questions Roadmap: Docker & containers

More on Operations, Rootless & Podman