In general I would say that this is a Docker anti-pattern. But more specifically, when you’re running the
system command in your container, that command is running in your container’s process namespace, not in the host’s process namespace. There is a
--pid=host option in the
docker run command but I believe it’s only for examining the host’s processes. No idea whether you could actually use this to start a process on the host, but might be worth at least testing. You probably will need to use the
--privileged option in order for this to work at all.
--pid option isn’t even isolated to making host processes visible, it can also make visible processes from other containers by way of
--pid=container:<name or id of container>
Please report back if this does what you’re intending. I’d test it but it’s too much of a pain to do that in the Docker for Mac environment that I’ve get setup at the moment.