summaryrefslogtreecommitdiff
path: root/libpod/define
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-01-18 06:22:05 -0500
committerGitHub <noreply@github.com>2022-01-18 06:22:05 -0500
commitd6b0720b9cd5d993dffc229e73d8377aae2c2ed4 (patch)
treea0efd9dff39774597d87c98dbe089b57af77c726 /libpod/define
parentd0eb24bae0023848447568d024acdaadb632edfe (diff)
parent141de86862898a4b9e35c15f51031952c63c7114 (diff)
downloadpodman-d6b0720b9cd5d993dffc229e73d8377aae2c2ed4.tar.gz
podman-d6b0720b9cd5d993dffc229e73d8377aae2c2ed4.tar.bz2
podman-d6b0720b9cd5d993dffc229e73d8377aae2c2ed4.zip
Merge pull request #12684 from mheon/remap_states
Revamp Libpod state strings for Docker compat
Diffstat (limited to 'libpod/define')
-rw-r--r--libpod/define/containerstate.go15
1 files changed, 11 insertions, 4 deletions
diff --git a/libpod/define/containerstate.go b/libpod/define/containerstate.go
index fc272beaa..23ba1f451 100644
--- a/libpod/define/containerstate.go
+++ b/libpod/define/containerstate.go
@@ -37,16 +37,23 @@ const (
ContainerStateStopping ContainerStatus = iota
)
-// ContainerStatus returns a string representation for users
-// of a container state
+// ContainerStatus returns a string representation for users of a container
+// state. All results should match Docker's versions (from `docker ps`) as
+// closely as possible, given the different set of states we support.
func (t ContainerStatus) String() string {
switch t {
case ContainerStateUnknown:
return "unknown"
case ContainerStateConfigured:
- return "configured"
- case ContainerStateCreated:
+ // The naming here is confusing, but it's necessary for Docker
+ // compatibility - their Created state is our Configured state.
return "created"
+ case ContainerStateCreated:
+ // Docker does not have an equivalent to this state, so give it
+ // a clear name. Most of the time this is a purely transitory
+ // state between Configured and Running so we don't expect to
+ // see it much anyways.
+ return "initialized"
case ContainerStateRunning:
return "running"
case ContainerStateStopped: