When getting the uptime inside a docker container, the kernel will report the host uptime. In order to get the container uptime, we should get the uptime of PID 1, that is the process that starts when the container is starting.
To get the running time of pid 1 inside the container, we could use something like
When getting the uptime inside a docker container, the kernel will report the host uptime. In order to get the container uptime, we should get the uptime of PID 1, that is the process that starts when the container is starting.
To get the running time of pid 1 inside the container, we use