1

I'm running a node.js app within a docker container (because I can't install node on our machines). My app uses the systeminformation package to get cpu utilisation, but this is cpu utilisation of the docker container. I want the CPU utilisation of a process running on the host.

Can this be done?

1 Answer 1

2

Use the PID namespace of the host with the --pid=host option to docker run.

From the manpage:

 --pid="" Set the PID mode for the container Default is to create a private PID namespace for the container 'container:<name|id>': join another container's PID namespace 'host': use the host's PID namespace for the container. Note: the host mode gives the container 

full access to local PID and is therefore considered insecure.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.