summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorchesedo <pieter@chesedo.me>2022-06-22 16:52:18 +0200
committerchesedo <pieter@chesedo.me>2022-06-28 15:50:45 +0200
commitcc49146332e279644f1357c6a5e209927bd73471 (patch)
tree7c646d49ac5947e90ce111e7e4c72ba9ab3c9cfa /pkg
parent2382955c6a88e506ce6d85477c8c68bd24859bdd (diff)
downloadpodman-cc49146332e279644f1357c6a5e209927bd73471.tar.gz
podman-cc49146332e279644f1357c6a5e209927bd73471.tar.bz2
podman-cc49146332e279644f1357c6a5e209927bd73471.zip
Docker compat returning unknown "initialized" for `status.status`
Some background for this PR is in discussion #14641. In short, ever so often a container inspect will return a `status.status` of `initialized` from the Docker compat socket. From the discussion I found these lines which tries to fix a "configured" status to "created". https://github.com/containers/podman/blob/c936d1e61154b6826e9d8df46e9660aba6c86cfe/pkg/api/handlers/compat/containers.go#L291-L294 However, commit 141de8686289 (Revamp Libpod state strings for Docker compat) removed the "configured" return value from the `String()` method called on line 291 above. Thus, making the `if` check redundant as it will never hit. But the same commit also introduces a return for "initialized" which this `if` should probably have been adapted for. Signed-off-by: Pieter Engelbrecht <pieter@shuttle.rs>
Diffstat (limited to 'pkg')
-rw-r--r--pkg/api/handlers/compat/containers.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/pkg/api/handlers/compat/containers.go b/pkg/api/handlers/compat/containers.go
index 616f0a138..411b0efe9 100644
--- a/pkg/api/handlers/compat/containers.go
+++ b/pkg/api/handlers/compat/containers.go
@@ -289,8 +289,10 @@ func LibpodToContainer(l *libpod.Container, sz bool) (*handlers.Container, error
return nil, err
}
stateStr := state.String()
- if stateStr == "configured" {
- stateStr = "created"
+
+ // Some docker states are not the same as ours. This makes sure the state string stays true to the Docker API
+ if state == define.ContainerStateCreated {
+ stateStr = define.ContainerStateConfigured.String()
}
switch state {
@@ -420,9 +422,9 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*types.ContainerJSON,
state.Running = true
}
- // docker calls the configured state "created"
- if state.Status == define.ContainerStateConfigured.String() {
- state.Status = define.ContainerStateCreated.String()
+ // Dockers created state is our configured state
+ if state.Status == define.ContainerStateCreated.String() {
+ state.Status = define.ContainerStateConfigured.String()
}
if l.HasHealthCheck() && state.Status != "created" {