mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-10 21:53:57 +08:00
Use same state object for state and list
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
@@ -22,6 +22,8 @@ const formatOptions = `table or json`
|
||||
// containerState represents the platform agnostic pieces relating to a
|
||||
// running container's status and state
|
||||
type containerState struct {
|
||||
// Version is the OCI version for the container
|
||||
Version string `json:"ociVersion"`
|
||||
// ID is the container ID
|
||||
ID string `json:"id"`
|
||||
// InitProcessPid is the init process id in the parent namespace
|
||||
@@ -30,6 +32,8 @@ type containerState struct {
|
||||
Status string `json:"status"`
|
||||
// Bundle is the path on the filesystem to the bundle
|
||||
Bundle string `json:"bundle"`
|
||||
// Rootfs is a path to a directory containing the container's root filesystem.
|
||||
Rootfs string `json:"rootfs"`
|
||||
// Created is the unix timestamp for the creation time of the container in UTC
|
||||
Created time.Time `json:"created"`
|
||||
// Annotations is the user defined annotations added to the config.
|
||||
@@ -140,10 +144,12 @@ func getContainers(context *cli.Context) ([]containerState, error) {
|
||||
}
|
||||
bundle, annotations := utils.Annotations(state.Config.Labels)
|
||||
s = append(s, containerState{
|
||||
Version: state.BaseState.Config.Version,
|
||||
ID: state.BaseState.ID,
|
||||
InitProcessPid: pid,
|
||||
Status: containerStatus.String(),
|
||||
Bundle: bundle,
|
||||
Rootfs: state.BaseState.Config.Rootfs,
|
||||
Created: state.BaseState.Created,
|
||||
Annotations: annotations,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user