inspection
docker top
Displays the running processes inside a container, similar to running ps on the host restricted to that container's PID namespace. Accepts standard ps flags after the container name.
docker top CONTAINER [ps OPTIONS] Common flags
| Flag | Purpose |
|---|---|
| aux | ps(1) argument passed through — BSD-style, shows all users + processes |
| -ef | ps(1) argument passed through — full listing with parent PID |
| -o pid,cmd | ps(1) argument passed through — custom column selection |
Examples
docker top web Default process list for the web container
docker top web aux BSD ps-style detailed output
docker top db -eo pid,user,cmd Custom columns
docker top worker -ef System V ps format
Gotcha
docker top has no flags of its own — anything after the container name is passed straight to `ps(1)` inside the container namespace. Different distros' ps behave differently.
Related commands
docker ps
Lists containers along with their status, ports, and identifiers. By default it shows only running containers unless -a is passed.
docker exec
Runs a new command inside an already running container. Commonly used for shells, debugging, or one-off maintenance tasks.
docker inspect
Returns low-level JSON metadata about Docker objects — containers, images, networks, volumes, and more. Supports Go template formatting for extracting specific fields.
docker logs
Fetches the stdout/stderr logs of a container. Works with the json-file and local logging drivers; other drivers require querying the destination directly.
← All Docker commands · Docker vs Kubernetes · Docker vs VMs