uptime command gives weird results in a docker image

cfischer asked:

If I run a docker image and call uptime, I always get a longer value than the real one.

docker run -it 1d2dfb3a35ab
root@7efb3e947f73:/# uptime
 23:41:57 up 16 min,  0 users,  load average: 0.06, 0.02, 0.00

It hasn’t been running for 16 minutes, not even 16 seconds. =:-O

Is this a known issue or what?

My answer:

The displayed uptime is that of the host. The kernel does not track uptime for individual containers in this way (though Docker does).

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.