Jira (FACT-2737) facter uptime shows host uptime inside docker container

21 views
Skip to first unread message

Florin Dragos (Jira)

unread,
Aug 4, 2020, 7:11:03 AM8/4/20
to puppe...@googlegroups.com
Florin Dragos created an issue
 
Facter / Bug FACT-2737
facter uptime shows host uptime inside docker container
Issue Type: Bug Bug
Assignee: Unassigned
Components: Facter 4
Created: 2020/08/04 4:10 AM
Priority: Normal Normal
Reporter: Florin Dragos

To get the running time of pid 1 inside the container, we could use something like 

ps -o etime= -p "1"

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Mihai Buzgau (Jira)

unread,
Aug 11, 2020, 8:24:04 AM8/11/20
to puppe...@googlegroups.com

Mihai Buzgau (Jira)

unread,
Aug 11, 2020, 8:28:03 AM8/11/20
to puppe...@googlegroups.com

Bogdan Irimie (Jira)

unread,
Aug 12, 2020, 5:52:03 AM8/12/20
to puppe...@googlegroups.com
Bogdan Irimie updated an issue
Change By: Bogdan Irimie
Sprint: ready for triage ghost-19

Bogdan Irimie (Jira)

unread,
Aug 12, 2020, 5:54:03 AM8/12/20
to puppe...@googlegroups.com

Bogdan Irimie (Jira)

unread,
Aug 14, 2020, 9:26:03 AM8/14/20
to puppe...@googlegroups.com

Bogdan Irimie (Jira)

unread,
Aug 17, 2020, 8:07:03 AM8/17/20
to puppe...@googlegroups.com
Bogdan Irimie commented on Bug FACT-2737
 
Re: facter uptime shows host uptime inside docker container

After the fix

  • on machine

    ./facter facterversion system_uptime
    facterversion => 4.0.34
    system_uptime => {
      days => 3,
      hours => 73,
      seconds => 264126,
      uptime => "3 days"
    

  • in docker container

    ./facter facterversion system_uptime
    facterversion => 4.0.34
    system_uptime => {
      days => 0,
      hours => 0,
      seconds => 682,
      uptime => "0:11 hours"
    }
    

Mihai Buzgau (Jira)

unread,
Nov 5, 2020, 9:39:03 AM11/5/20
to puppe...@googlegroups.com

Florin Dragos (Jira)

unread,
Nov 5, 2020, 4:20:03 PM11/5/20
to puppe...@googlegroups.com
Florin Dragos updated an issue
Change By: Florin Dragos
Release Notes: Not Needed Bug Fix

Florin Dragos (Jira)

unread,
Nov 5, 2020, 4:22:03 PM11/5/20
to puppe...@googlegroups.com
Florin Dragos updated an issue
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 
{code:java}
ps -o etime= -p "1"
{code}

Florin Dragos (Jira)

unread,
Nov 5, 2020, 4:23:02 PM11/5/20
to puppe...@googlegroups.com

Florin Dragos (Jira)

unread,
Nov 5, 2020, 4:28:03 PM11/5/20
to puppe...@googlegroups.com
Florin Dragos updated an issue
Change By: Florin Dragos
Release Notes Summary:
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

ps -o etime= -p "1"

Claire Cadman (Jira)

unread,
Nov 10, 2020, 6:04:03 AM11/10/20
to puppe...@googlegroups.com
Claire Cadman updated an issue
Change By: Claire Cadman
Labels: doc_reviewed platform_7
Reply all
Reply to author
Forward
0 new messages