For administrative reasons a container might need to have access to the processes running on the host machine or on another container on the same host.

In docker, we could achieve that using the "--pid=host" parameter on the command line, when creating our container.

We create a container using the below command. 
For our example, we will use "Alpine", which is a very small distribution of Linux.


After downloading the image of "Alpine", because it was not available locally, we get a command prompt.

At the command prompt, we type the command "ps" to see the processes running in the PID namespace of our "Alpine" container:


We can see that we also have access to the processes running on the host machine.

Remark:

We can even have access from our "Alpine" container to processes from other containers that are running on the same host.
Brando Sabatini and Ikbal C ©. Powered by Blogger.