Why can't I see the mongo PID in process state list on mac
You need to docker exec to your mongodb container, running in your XHyve/HyperKit VM.
docker exec -it <containerID> bash
Then you can execute a ps, and see the mongodb pid there.
See as an example (on Mac) this article "How to use MongoDB & NodeJS with Docker".
As Matt adds in the comments:
You can also connect to the vm to see the real pid with
screen ~/Library/Containers/com.docker.docker/Data/com.docker.drive‌r.amd64-linux/tty
(as mentioned in "Where is /var/lib/docker on Mac/OS X")
As others have mentioned, when running on MAC, Docker is actually running in the backgound inside a VM and thus you will not be able to see the container process directly.
Moreover, even if you connect to the actual VM and check the PID for mongo container it will be different from the PID reported back when you run docker top mongo
.
This is due to PID namespaces that docker uses to isolate processes running inside the docker container. So don't rely on the PID to detect the process.