Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

podman inspect returns State.Healthcheck when docker uses State.Health #11645

Closed
abitrolly opened this issue Sep 18, 2021 · 2 comments · Fixed by #11654
Closed

podman inspect returns State.Healthcheck when docker uses State.Health #11645

abitrolly opened this issue Sep 18, 2021 · 2 comments · Fixed by #11654
Assignees
Labels
In Progress This issue is actively being worked by the assignee, please do not work on this at this time. kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@abitrolly
Copy link
Contributor

abitrolly commented Sep 18, 2021

/kind bug

Description

Scripts that check health of containers are incompatible between docker and podman.

Steps to reproduce the issue:

  1. Run a container with a healthcheck and then inspect it with docker
$ docker inspect --format "{{json .State }}" warehouse_db_1 | jq
{
  "Status": "exited",
  "Running": false,
  "Paused": false,
  "Restarting": false,
  "OOMKilled": false,
  "Dead": false,
  "Pid": 0,
  "ExitCode": 0,
  "Error": "",
  "StartedAt": "2021-09-18T12:59:02.996240627Z",
  "FinishedAt": "2021-09-18T13:21:01.053654425Z",
  "Health": {
    "Status": "unhealthy",
    "FailingStreak": 0,
    "Log": [
      {
        "Start": "2021-09-18T13:20:39.925990714Z",
...
  1. The run the container with podman and inspect it as well.
$ podman inspect --format "{{json .State }}" warehouse_db_1 | jq
{
  "OciVersion": "1.0.2-dev",
  "Status": "configured",
  "Running": false,
  "Paused": false,
  "Restarting": false,
  "OOMKilled": false,
  "Dead": false,
  "Pid": 0,
  "ExitCode": 0,
  "Error": "",
  "StartedAt": "0001-01-01T00:00:00Z",
  "FinishedAt": "0001-01-01T00:00:00Z",
  "Healthcheck": {
    "Status": "",
    "FailingStreak": 0,
    "Log": null
  }
}

Describe the results you received:

podman uses State.Healthcheck,Status
docker uses State.Health.Status

Describe the results you expected:

Both use State.Health.Status.

Output of podman version:

$ podman version
Version:      3.3.1
API Version:  3.3.1
Go Version:   go1.16.6
Built:        Thu Jan  1 00:00:00 1970
OS/Arch:      linux/amd64

Additional environment details (AWS, VirtualBox, physical, etc.):

$ docker version
Client: Docker Engine - Community
 Version:           19.03.13
 API version:       1.40
 Go version:        go1.13.15
 Git commit:        4484c46d9d
 Built:             Wed Sep 16 17:02:36 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.13
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       4484c46d9d
  Built:            Wed Sep 16 17:01:06 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.9
  GitCommit:        e25210fe30a0a703442421b0f60afac609f950a3
 runc:
  Version:          1.0.1
  GitCommit:        v1.0.1-0-g4144b63
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683
@openshift-ci openshift-ci bot added the kind/bug Categorizes issue or PR as related to a bug. label Sep 18, 2021
@Luap99 Luap99 self-assigned this Sep 20, 2021
@Luap99 Luap99 added the In Progress This issue is actively being worked by the assignee, please do not work on this at this time. label Sep 20, 2021
Luap99 added a commit to Luap99/libpod that referenced this issue Sep 20, 2021
podman inspect shows the healthcheck status in `.State.Healthcheck`,
docker uses `.State.Health`. To make sure docker scripts work we
should add the `Health` field and since we should not break existing
users of the `Healthcheck` field, we show both fields. While this is
redundant, it is better than breaking users.

Fixes containers#11645

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
@Luap99
Copy link
Member

Luap99 commented Sep 21, 2021

Is it ok for you to only add Health as method to the struct, this would make {{json .State.Health }} work but {{json .State }} will still not include the Health key.

Luap99 added a commit to Luap99/libpod that referenced this issue Sep 21, 2021
podman inspect shows the healthcheck status in `.State.Healthcheck`,
docker uses `.State.Health`. To make sure docker scripts work we
should add the `Health` key as method. This will return the same as
Healthcheck but is not displayed by default in the inspect output.
But if a users uses `--format {{.State.Health}}` it works now.

Fixes containers#11645

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
@abitrolly
Copy link
Contributor Author

@Luap99 not really. The reason I spotted this is because I was developing my scripts with podman and they've failed when run by GitHub Actions with docker. I spent a lot of time trying to debug what is going on.

Luap99 added a commit to Luap99/libpod that referenced this issue Sep 22, 2021
podman inspect shows the healthcheck status in `.State.Healthcheck`,
docker uses `.State.Health`. To make sure docker scripts work we
should add the `Health` key. Because we do not want to display both keys
by default we only use the new `Health` key. This is a breaking change
for podman users but matches what docker does. To provide some form of
compatibility users can still use `--format {{.State.Healthcheck}}`. IT
is just not shown by default.

Fixes containers#11645

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Luap99 added a commit to Luap99/libpod that referenced this issue Sep 22, 2021
podman inspect shows the healthcheck status in `.State.Healthcheck`,
docker uses `.State.Health`. To make sure docker scripts work we
should add the `Health` key. Because we do not want to display both keys
by default we only use the new `Health` key. This is a breaking change
for podman users but matches what docker does. To provide some form of
compatibility users can still use `--format {{.State.Healthcheck}}`. IT
is just not shown by default.

Fixes containers#11645

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Luap99 added a commit to Luap99/libpod that referenced this issue Sep 22, 2021
podman inspect shows the healthcheck status in `.State.Healthcheck`,
docker uses `.State.Health`. To make sure docker scripts work we
should add the `Health` key. Because we do not want to display both keys
by default we only use the new `Health` key. This is a breaking change
for podman users but matches what docker does. To provide some form of
compatibility users can still use `--format {{.State.Healthcheck}}`. IT
is just not shown by default.

Fixes containers#11645

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Luap99 added a commit to Luap99/libpod that referenced this issue Sep 23, 2021
podman inspect shows the healthcheck status in `.State.Healthcheck`,
docker uses `.State.Health`. To make sure docker scripts work we
should add the `Health` key. Because we do not want to display both keys
by default we only use the new `Health` key. This is a breaking change
for podman users but matches what docker does. To provide some form of
compatibility users can still use `--format {{.State.Healthcheck}}`. IT
is just not shown by default.

Fixes containers#11645

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
openstack-mirroring pushed a commit to openstack-archive/tripleo-heat-templates that referenced this issue Sep 20, 2023
This patch makes container healthcheck work also with versions of
podman(-remote) lower than 4.0.0. For more infor please check [1].

[1] containers/podman#11645

Resolves: rhbz#2223294
Change-Id: I4acdb425f19802424800876c11838364b623bc07
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 21, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
In Progress This issue is actively being worked by the assignee, please do not work on this at this time. kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants