We will help you to understand how to show the running processes in docker container. For this, we use “docker top container_name” command.
“docker top” command can be used with various options to show the running processes of a docker container.
Usage:
docker top container_name_1
Options:
Name | Description |
PID | Process ID |
How docker top command works ?
- When we use docker top command with container name, It shows running processes having process ID, parent process ID, create time and total time of processes running.
- One container can have multiple processes. So with this command, we can also get details of specific process.
- If you give invalid process ID in top command, It won’t show any thing.
Example:
% docker top redis
UID PID PPID C STIME TTY TIME CMD
999 2552 2527 0 10:33 ? 00:00:03 redis-server *:6379
% docker top redis 2552 >> Here, 2552 is a process ID
PID TTY STAT TIME COMMAND
2552 ? Ssl+ 0:04 redis-server *:6379
% docker top redis 2520 >> Here, 2520 is a invalid process ID.
PID TTY STAT TIME COMMAND
To learn more about docker, Please refer given below link:
https://www.techieindoor.com/category/docker/
References: