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

Does not schedule healthcheck for images with HEALTHCHECK #3525

Closed
stefanb2 opened this issue Jul 9, 2019 · 2 comments
Closed

Does not schedule healthcheck for images with HEALTHCHECK #3525

stefanb2 opened this issue Jul 9, 2019 · 2 comments
Labels
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

@stefanb2
Copy link
Contributor

stefanb2 commented Jul 9, 2019

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description

podman only schedules health check when command line option --healthcheck-command is given but not when the docker image has a HEALTHCHECK configuration. This is a regression compared to Docker CLI behaviour.

Steps to reproduce the issue:

  1. build (docker) image with HEALTHCHECK in Dockerfile
  2. create container from image using podman

Describe the results you received:

# image created by "docker build"
$ podman run --rm -d --name test docker.COMPANY.COM:5004/PATH/mongo:3.4.7
1ff89ce50e988d02bcf0393cce75b5a03e8136470fb04bd8efe5140e1cdab56f

$ podman container inspect --format='{{json .Config.Healthcheck}}' test
{"Test":["CMD","docker-healthcheck"]}

# the following never changes...
$ podman container inspect --format='{{json .State.Healthcheck}}' test
{"Status":"starting","FailingStreak":0,"Log":null}


# local image created by "podman build" from Dockerfile
$ fgrep -A1 HEALTH Dockerfile
HEALTHCHECK --interval=1m --timeout=5s --retries=3 \
    CMD curl -fsS http://localhost:8080/docs -o /dev/null || exit 1

$ podman image inspect localhost/PROJECT/mock | fgrep -i HEALTH
 "created_by": "/bin/sh -c #(nop) HEALTHCHECK --interval=1m --timeout=5s --retries=3     CMD curl -fsS http://localhost:8080/docs -o /dev/null || exit 1",

$ podman run --rm -d --name test localhost/PROJECT/mock
a416421d7718c00c6420a475ec33dfa6545f3f4de8609fecc660f0b3c2f1edda

$ podman container inspect --format='{{json .Config.Healthcheck}}' test
null
$ podman container inspect --format='{{json .State.Healthcheck}}' test
{"Status":"","FailingStreak":0,"Log":null}

(IMHO the podman build example indicates another bug, because the HEALTHCHECK issue gets lost completely...)

Describe the results you expected:

Health check service & timer should be created.

Additional information you deem important (e.g. issue happens only occasionally):

May be related to #3507?

Output of podman version:

Version:            1.4.5-dev
RemoteAPI Version:  1
Go Version:         go1.12.6
OS/Arch:            linux/amd64

Output of podman info --debug:

debug:
  compiler: gc
  git commit: ""
  go version: go1.12.6
  podman version: 1.4.5-dev
host:
  BuildahVersion: 1.9.0
  Conmon:
    package: podman-1.4.4-1.fc30.x86_64
    path: /usr/libexec/podman/conmon
    version: 'conmon version 0.2.0, commit: 41010e63c287618b1dc34ee11d10d268e2feeefe'
  Distribution:
    distribution: fedora
    version: "30"
  MemFree: 17038602240
  MemTotal: 33400737792
  OCIRuntime:
    package: runc-1.0.0-93.dev.gitb9b6cc6.fc30.x86_64
    path: /usr/bin/runc
    version: |-
      runc version 1.0.0-rc8+dev
      commit: e3b4c1108f7d1bf0d09ab612ea09927d9b59b4e3
      spec: 1.0.1-dev
  SwapFree: 32002535424
  SwapTotal: 32002535424
  arch: amd64
  cpus: 12
  hostname: beckst-lnx
  kernel: 5.1.16-300.fc30.x86_64
  os: linux
  rootless: true
  uptime: 39h 7m 49.8s (Approximately 1.62 days)
registries:
  blocked: null
  insecure: null
  search:
  - docker.io
  - registry.fedoraproject.org
  - quay.io
  - registry.access.redhat.com
  - registry.centos.org
store:
  ConfigFile: /home/stefanb/.config/containers/storage.conf
  ContainerStore:
    number: 0
  GraphDriverName: overlay
  GraphOptions:
  - overlay.mount_program=/usr/bin/fuse-overlayfs
  GraphRoot: /home/stefanb/.local/share/containers/storage
  GraphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "false"
  ImageStore:
    number: 6
  RunRoot: /tmp/1000
  VolumePath: /home/stefanb/.local/share/containers/storage/volumes
@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Jul 9, 2019
@stefanb2 stefanb2 changed the title Does not schedule healthcheck for images with HEALTCHECK Does not schedule healthcheck for images with HEALTHCHECK Jul 9, 2019
@stefanb2
Copy link
Contributor Author

I think I now understand the root cause for this: if a docker image doesn't provide a HEALTHCHECK option (interval, retries, timeout, start_period) then podman does not apply the standard default values like Docker does.

I.e. with an image created from the following Dockerfile snippet

HEALTHCHECK --interval=30s --timeout=30s --retries=3 CMD xyz

podman would schedule a healthcheck.

@stefanb2
Copy link
Contributor Author

Furthermore: podman must disable the healthcheck if image has been built with HEALTHCHECK NONE. It should not create a healthcheck configuration with command list ["NONE"].

stefanb2 added a commit to stefanb2/libpod that referenced this issue Jul 16, 2019
If the image was built with "HEALTHCHECK NONE" then we should create a
container without healthcheck configuration. Otherwise executing the
healthcheck on the container will return "unhealthy" instead of the
correct error message that the container doesn't have a healthcheck.

We also ignore the healthcheck configuration if the command list is
empty or the command string is empty.

Fixes containers#3525

Signed-off-by: Stefan Becker <[email protected]>
ryanfaircloth added a commit to splunk/splunk-connect-for-syslog that referenced this issue Aug 31, 2021
Some older versions of podman don't have proper defaults for HEALTHCHECK
containers/podman#3525
ryanfaircloth added a commit to splunk/splunk-connect-for-syslog that referenced this issue Aug 31, 2021
Some older versions of podman don't have proper defaults for HEALTHCHECK
containers/podman#3525
@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 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
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

No branches or pull requests

2 participants