Interview Prep/Docker/Containers, VMs & Isolation Internals

Why can a container "see" only its own processes with `ps`?

IntermediateConceptContainers, VMs & Isolation Internals
Answer

Because of the PID namespace plus its own /proc mount. ps reads /proc, and the container's /proc reflects only its PID namespace. docker run --pid=host shares the host's PID namespace and makes all host processes visible, which is a security risk but useful for debugging.

All Docker questions Roadmap: Docker & containers

More on Containers, VMs & Isolation Internals