Junior — Middle
Is it possible to view processes of the host operating system running outside the Docker container?
sobes.tech AI
Answer from AI
Yes, it is possible to view processes of the host operating system running outside the Docker container, but you need to exit the container or use special settings. By default, containers are isolated, and commands like ps inside the container will only show processes within it. To see host processes, you can:
- Run the
psortopcommand directly on the host. - Start the container with the
--pid=hostparameter so that container and host processes share the same PID namespace.
Example of running a container with access to host processes:
docker run --pid=host -it ubuntu bash
ps aux
This allows you to see all host processes from within the container.