1. docker container top
(Recommended tutorial: docker tutorial)
[xxx@single xxx]# docker container top <container>
Using redis example
[xxx@single xxx]# docker container top redis
You can see the PID of the redis container from the output result
PID USER TIME COMMAND 2208 999 1:47 redis-server *:637912
2. Docker container inspect
[xxx@single xxx]# docker inspect -f '{{.State.Pid}}' <container>1
Using redis as an example
[xxx@single xxx]# docker inspect -f '{{.State.Pid}}' redis1
This command will directly output the PID
2208
The above is the detailed content of How to check the PID of a docker container. For more information, please follow other related articles on the PHP Chinese website!