Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Docker top command

Docker top command

Docker Command ReferenceDocker Command Reference


docker top The command is used to display the running processes in a specified container.

docker top The command is similar to a command in Linux top or ps ; it helps users view process information inside a container, making it easy to monitor and debug activity within the container.

Syntax

docker top [OPTIONS] CONTAINER [ps OPTIONS]

View the processes inside a container:



docker top my_container

This displays all running processes in the container my_container.

** Using custom ps options:**



docker top my_container -o pid,comm

This displays all running processes in the container my_container, showing only the pid and comm columns.

Example

View the processes inside the container:

docker top my_container

Example output:

UID       PID        PPID      C      STIME    TTY        TIME          CMD

root      1725       1708      0      14:02    ?          00:00:00      bash

root      1767       1725      0      14:03    ?          00:00:00      ps

Custom output:



docker top my_container -o pid,comm

Example output:



PID                 COMMAND

1725                bash

1767                ps

Common Scenarios

docker top The command is a useful tool that helps users view information about the processes running inside a container. With it, users can monitor, debug, and manage activity inside the container to ensure it runs normally.


Docker Command ReferenceDocker Command Reference