mirror of
https://github.com/containers/podman.git
synced 2025-05-21 17:16:22 +08:00
Add Runc and Conmon versions to Podman Version
It will be handy to know the runc and conmon versions as our code gets into the wild. Signed-off-by: baude <bbaude@redhat.com> Closes: #1207 Approved by: rhatdan
This commit is contained in:
@ -26,19 +26,22 @@ Change output format to "json" or a Go template.
|
|||||||
|
|
||||||
## EXAMPLE
|
## EXAMPLE
|
||||||
|
|
||||||
|
Run podman info with plain text response:
|
||||||
```
|
```
|
||||||
$ podman info
|
$ podman info
|
||||||
host:
|
host:
|
||||||
MemFree: 7822168064
|
MemFree: 28464242688
|
||||||
MemTotal: 33080606720
|
MemTotal: 33147686912
|
||||||
SwapFree: 34357637120
|
OCIRuntimeVersion: 'runc version spec: 1.0.0'
|
||||||
|
SwapFree: 34359734272
|
||||||
SwapTotal: 34359734272
|
SwapTotal: 34359734272
|
||||||
arch: amd64
|
arch: amd64
|
||||||
|
conmonVersion: 'conmon version 1.11.0-dev, commit: 42209340c7abcab66f47e9161fa0f1b16ea8c134'
|
||||||
cpus: 8
|
cpus: 8
|
||||||
hostname: localhost.localdomain
|
hostname: localhost.localdomain
|
||||||
kernel: 4.13.16-300.fc27.x86_64
|
kernel: 4.17.9-200.fc28.x86_64
|
||||||
os: linux
|
os: linux
|
||||||
uptime: 142h 13m 55.64s (Approximately 5.92 days)
|
uptime: 47m 34.95s
|
||||||
insecure registries:
|
insecure registries:
|
||||||
registries: []
|
registries: []
|
||||||
registries:
|
registries:
|
||||||
@ -48,7 +51,7 @@ registries:
|
|||||||
- registry.access.redhat.com
|
- registry.access.redhat.com
|
||||||
store:
|
store:
|
||||||
ContainerStore:
|
ContainerStore:
|
||||||
number: 7
|
number: 40
|
||||||
GraphDriverName: overlay
|
GraphDriverName: overlay
|
||||||
GraphOptions:
|
GraphOptions:
|
||||||
- overlay.override_kernel_check=true
|
- overlay.override_kernel_check=true
|
||||||
@ -61,32 +64,56 @@ store:
|
|||||||
number: 10
|
number: 10
|
||||||
RunRoot: /var/run/containers/storage
|
RunRoot: /var/run/containers/storage
|
||||||
```
|
```
|
||||||
|
Run podman info with JSON formatted response:
|
||||||
```
|
```
|
||||||
$ podman info --debug --format json
|
$ podman info --debug --format json
|
||||||
{
|
{
|
||||||
"host": {
|
"host": {
|
||||||
"MemFree": 7506157568,
|
"MemFree": 28421324800,
|
||||||
"MemTotal": 33080606720,
|
"MemTotal": 33147686912,
|
||||||
"SwapFree": 34357637120,
|
"OCIRuntimeVersion": "runc version spec: 1.0.0",
|
||||||
|
"SwapFree": 34359734272,
|
||||||
"SwapTotal": 34359734272,
|
"SwapTotal": 34359734272,
|
||||||
"arch": "amd64",
|
"arch": "amd64",
|
||||||
|
"conmonVersion": "conmon version 1.11.0-dev, commit: 42209340c7abcab66f47e9161fa0f1b16ea8c134",
|
||||||
"cpus": 8,
|
"cpus": 8,
|
||||||
"hostname": "localhost.localdomain",
|
"hostname": "localhost.localdomain",
|
||||||
"kernel": "4.13.16-300.fc27.x86_64",
|
"kernel": "4.17.9-200.fc28.x86_64",
|
||||||
"os": "linux",
|
"os": "linux",
|
||||||
"uptime": "142h 17m 17.04s (Approximately 5.92 days)"
|
"uptime": "50m 20.27s"
|
||||||
|
},
|
||||||
... removed for brevity
|
"insecure registries": {
|
||||||
|
"registries": []
|
||||||
|
},
|
||||||
|
"registries": {
|
||||||
|
"registries": [
|
||||||
|
"docker.io",
|
||||||
|
"registry.fedoraproject.org",
|
||||||
|
"registry.access.redhat.com",
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"store": {
|
||||||
|
"ContainerStore": {
|
||||||
|
"number": 40
|
||||||
|
},
|
||||||
|
"GraphDriverName": "overlay",
|
||||||
|
"GraphOptions": [
|
||||||
|
"overlay.override_kernel_check=true"
|
||||||
|
],
|
||||||
|
"GraphRoot": "/var/lib/containers/storage",
|
||||||
|
"GraphStatus": {
|
||||||
|
"Backing Filesystem": "extfs",
|
||||||
|
"Native Overlay Diff": "true",
|
||||||
|
"Supports d_type": "true"
|
||||||
|
},
|
||||||
"ImageStore": {
|
"ImageStore": {
|
||||||
"number": 10
|
"number": 10
|
||||||
},
|
},
|
||||||
"RunRoot": "/var/run/containers/storage"
|
"RunRoot": "/var/run/containers/storage"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
Run podman info and only get the registries information.
|
||||||
```
|
```
|
||||||
$ podman info --format={{".registries"}}
|
$ podman info --format={{".registries"}}
|
||||||
map[registries:[docker.io registry.fedoraproject.org registry.access.redhat.com]]
|
map[registries:[docker.io registry.fedoraproject.org registry.access.redhat.com]]
|
||||||
|
@ -7,10 +7,12 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/docker/docker/pkg/system"
|
"github.com/docker/docker/pkg/system"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
"github.com/projectatomic/libpod/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
// InfoData holds the info type, i.e store, host etc and the data for each type
|
// InfoData holds the info type, i.e store, host etc and the data for each type
|
||||||
@ -84,6 +86,11 @@ func (r *Runtime) hostInfo() (map[string]interface{}, error) {
|
|||||||
}
|
}
|
||||||
info["hostname"] = host
|
info["hostname"] = host
|
||||||
|
|
||||||
|
// Don't think this should be catastrophic if we cannot get the versions
|
||||||
|
conmonVersion, _ := r.GetConmonVersion()
|
||||||
|
ociruntimeVersion, _ := r.GetOCIRuntimeVersion()
|
||||||
|
info["conmonVersion"] = conmonVersion
|
||||||
|
info["OCIRuntimeVersion"] = ociruntimeVersion
|
||||||
return info, nil
|
return info, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,3 +153,21 @@ func readUptime() (string, error) {
|
|||||||
}
|
}
|
||||||
return string(f[0]), nil
|
return string(f[0]), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetConmonVersion returns a string representation of the conmon version
|
||||||
|
func (r *Runtime) GetConmonVersion() (string, error) {
|
||||||
|
output, err := utils.ExecCmd(r.conmonPath, "--version")
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
return strings.TrimSuffix(strings.Replace(output, "\n", ", ", 1), "\n"), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOCIRuntimeVersion returns a string representation of the oci runtimes version
|
||||||
|
func (r *Runtime) GetOCIRuntimeVersion() (string, error) {
|
||||||
|
output, err := utils.ExecCmd(r.ociRuntimePath, "--version")
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
return strings.TrimSuffix(output, "\n"), nil
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user