Hello,
I have my docker container running on ubuntu-20.04 machine. Many processed are running inside the container. On running “top” and “ps” command inside the container I can see the processes running inside the container with specific PID.
If I use the “ps” commands (for any process running inside the container) on host i.e outside the container I could see the processes running inside the container but with different PIDs. It looks something like those processes are running on my host machine. And, If I stop my container and check with the “ps” command then the process will also disappear on host machine.
I am not understanding how and why does this is happening actually. Hoe really the processes inside the container are mapped? Is this really normal to see the process outside the container with different PID?
On using “ps -eaf” command I could see all the processes that are running inside the conrtainers are being shown on the host machine with username “root”
$: ps -eaf
on host machine:
#: ps -eaf
inside the container
sh-4.4# ps -eaf
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 07:27 ? 00:00:00 ping localhost
root 37 0 0 08:16 pts/0 00:00:00 sh
root 52 1 17 08:18 ? 00:01:42 [stress] <defunct>
root 62 0 0 08:27 pts/1 00:00:00 sh
root 68 62 0 08:27 pts/1 00:00:00 /bin/bash ./test_MEM_CPU.sh
root 77 68 0 08:28 pts/1 00:00:00 stress -c 1 --vm-keep --timeout 120s
root 81 77 79 08:28 pts/1 00:00:04 stress -c 1 --vm-keep --timeout 120s
root 83 37 0 08:28 pts/0 00:00:00 ps -eaf
Here we could see that same processes both inside the container and on host machine but with different PID. Is container really performing the virtualization here?
Can anybody help me on understanding this scenario? Any inputs will help me a lot.
Regards,
Siddhartha V