How to identify which docker container is consuming 100% CPU
- Open
htopand pressF6and selectPERCENT_CPU. Repeat until you’ve sorted descending by CPU consumption - Now identify the PID (process ID) of the offending process consuming 100% CPU

- In our example, the offending PID is
8599 - Now run this command to find a list of the running docker container by PID:
find_high_cpu_container.sh
docker inspect -f '{{.State.Pid}}, {{.Name}}' $(docker ps -q)- Now identify the line with the PID, e.g.
example.txt
8599, /wordpress-myblog-btronik_mariadb_1Now you know which container is consuming 100% CPU.
Check out similar posts by category:
Docker
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow