...

Source file src/github.com/opencontainers/runtime-spec/specs-go/state.go

Documentation: github.com/opencontainers/runtime-spec/specs-go

     1  package specs
     2  
     3  // ContainerState represents the state of a container.
     4  type ContainerState string
     5  
     6  const (
     7  	// StateCreating indicates that the container is being created
     8  	StateCreating ContainerState = "creating"
     9  
    10  	// StateCreated indicates that the runtime has finished the create operation
    11  	StateCreated ContainerState = "created"
    12  
    13  	// StateRunning indicates that the container process has executed the
    14  	// user-specified program but has not exited
    15  	StateRunning ContainerState = "running"
    16  
    17  	// StateStopped indicates that the container process has exited
    18  	StateStopped ContainerState = "stopped"
    19  )
    20  
    21  // State holds information about the runtime state of the container.
    22  type State struct {
    23  	// Version is the version of the specification that is supported.
    24  	Version string `json:"ociVersion"`
    25  	// ID is the container ID
    26  	ID string `json:"id"`
    27  	// Status is the runtime status of the container.
    28  	Status ContainerState `json:"status"`
    29  	// Pid is the process ID for the container process.
    30  	Pid int `json:"pid,omitempty"`
    31  	// Bundle is the path to the container's bundle directory.
    32  	Bundle string `json:"bundle"`
    33  	// Annotations are key values associated with the container.
    34  	Annotations map[string]string `json:"annotations,omitempty"`
    35  }
    36  
    37  const (
    38  	// SeccompFdName is the name of the seccomp notify file descriptor.
    39  	SeccompFdName string = "seccompFd"
    40  )
    41  
    42  // ContainerProcessState holds information about the state of a container process.
    43  type ContainerProcessState struct {
    44  	// Version is the version of the specification that is supported.
    45  	Version string `json:"ociVersion"`
    46  	// Fds is a string array containing the names of the file descriptors passed.
    47  	// The index of the name in this array corresponds to index of the file
    48  	// descriptor in the `SCM_RIGHTS` array.
    49  	Fds []string `json:"fds"`
    50  	// Pid is the process ID as seen by the runtime.
    51  	Pid int `json:"pid"`
    52  	// Opaque metadata.
    53  	Metadata string `json:"metadata,omitempty"`
    54  	// State of the container.
    55  	State State `json:"state"`
    56  }
    57  

View as plain text