See the processes running inside a container, from the host.
docker top shows the processes running in a container without needing a shell inside it. This page covers passing ps options and debugging a hung container.
What it does
docker top runs ps on the host scoped to the container processes, so it works even when the image has no ps binary. You can append standard ps options.
Common usage
Terminal
docker top web
docker top web aux
docker top web -eo pid,comm,%cpu,%mem
Common errors in CI
"Container ... is not running" - top only works on running containers; for an exited one read docker logs and the exit code via docker inspect. When a CI job hangs, docker top reveals whether the expected process is actually running or stuck, without needing a shell in a minimal image.
Frequently asked questions
docker top: View Processes in a Container?
docker top shows the processes running in a container without needing a shell inside it. This page covers passing ps options and debugging a hung container.
What it does?
docker top runs ps on the host scoped to the container processes, so it works even when the image has no ps binary. You can append standard ps options.
Common errors in CI?
"Container ... is not running" - top only works on running containers; for an exited one read docker logs and the exit code via docker inspect. When a CI job hangs, docker top reveals whether the expected process is actually running or stuck, without needing a shell in a minimal image.