How to identify which docker container is consuming 100% CPU

  • Open htop and press F6 and select PERCENT_CPU. Repeat until you’ve sorted descending by CPU consumption
  • Now identify the PID (process ID) of the offending process consuming 100% CPU

docker inspect -f '{{.State.Pid}}, {{.Name}}' $(docker ps -q)
  • Now identify the line with the PID, e.g.
8599, /wordpress-myblog-btronik_mariadb_1

Now you know which container is consuming 100% CPU.