state.go 1.9 KB

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