Read process RAM usage in real time from docker container using c#
So i have web app in asp.net that user Docker.dotnet to run some things in docker containers and i need to read memory of some process inside the container. How can i do it? it has to be in real time tho
1 Reply
The
System.Diagnostics
functions work well from inside docker containers (they were a little shaky back in the dotnet 2.0 days). I have this polling memory usage every two seconds if enabled by an environment variable and logging only when the memory usage increases. I've compared the output with docker stats
and it mirrors the container memory usage output.