docker-top
Display Docker container processes
TLDR
View documentation for the original command
SYNOPSIS
docker top [OPTIONS] CONTAINER [ps OPTIONS]
PARAMETERS
--help
Print usage information
CONTAINER
Container name or ID (required)
ps OPTIONS
Optional arguments passed to ps inside the container (e.g., aux, -eo pid,ppid,cmd)
DESCRIPTION
docker top provides a view of the running processes inside a specified Docker container, similar to the top or ps commands on a host system.
It executes the ps command within the container's environment, respecting its process namespace, PID namespace, and mount points. By default, it mimics top -b -n1 output if no arguments are provided, showing CPU, memory usage, and process details.
This is useful for monitoring resource consumption and troubleshooting issues without entering the container via docker exec. Note that PIDs shown are container-internal and may differ from host PIDs due to PID namespaces.
The command requires the container to be running; stopped containers will error. It's lightweight, as it doesn't attach an interactive shell.
CAVEATS
Container must be running; uses container's ps binary; non-interactive output only; PID namespaces hide host PIDs.
DEFAULT OUTPUT
Shows columns like PID, USER, TIME, CMD similar to top -b -n1.
EXAMPLE
docker top mycontainer
docker top mycontainer aux
HISTORY
Introduced in Docker 0.7.0 (June 2014) for container introspection; evolved with Docker's namespace support in later versions.


