I am doing some tests on docker and containers and I was wondering:
Is there a method I can use to find all process associated with a docker container by its name or ID from the host point of view.
After all, at the end of the day a container is a set of virtualized processes.
You can use docker top command. This command lists all processes running within your container. All methods mentioned by others are also possible to use but this one should be easiest.
Like it was mentioned, if you are already inside of a container, then just use ps -eaf command to see the running processes.
Yes this is normal. LXC containers are not virtualisation of hardware, and so there is a single kernel that is running all of the processes.
You can use docker top
command. This command lists all processes running within your container.
For instance this command on a single process container on my box displays:
UID PID PPID C STIME TTY TIME CMD root 14097 13930 0 23:17 pts/6 00:00:00 /bin/bash
All methods mentioned by others are also possible to use but this one should be easiest.
Update:
To simply get the main process id within the container use this command:
docker inspect -f '{{.State.Pid}}' <container id>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With