I'm wondering if it's possible to join two process namespaces in Linux. To demonstrate what I mean, the following is a scenario:
A process runs in its own separate namespace. Let[s call this process A.
Now Process A is doing its thing and I spin up another process B that is isolated within its own separate namespace.
Now process A and process B have their own separate namespace but I wish to "merge" their process namespaces as one. I.e, I want Process B to be able to see A's namespace and send signals/interact with A's processes.
The use case for this is that I ultimately want to attach a container to another running container such that the attached container can interact with the running container.
I have thought about setns()
but that won't work because Process B has no idea of Process A's namespace handles (/proc/PID/ns/pid
) since it is also in isolation. I am trying to think what the best way to achieve this is from the host system.
This has been implemented in docker here but I can't understand the logic behind it. Some implementation aspects are also discussed here if that helps.
Thanks for your time!