1
0
mirror of https://github.com/shirou/gopsutil.git synced 2025-04-28 13:48:49 +08:00

Merge pull request #496 from shirou/add_docker_to_use_btime

[host] linux: use uptime even if docker guest.
This commit is contained in:
shirou 2018-03-12 21:39:33 +09:00 committed by GitHub
commit d76e8c18d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -113,6 +113,9 @@ func BootTimeWithContext(ctx context.Context) (uint64, error) {
if system == "lxc" && role == "guest" {
// if lxc, /proc/uptime is used.
statFile = "uptime"
} else if system == "docker" && role == "guest" {
// also docker, guest
statFile = "uptime"
}
filename := common.HostProc(statFile)