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 docker-compose healthchecks issue #10617

Closed
pclass-sensonix opened this issue Jun 9, 2021 · 9 comments · Fixed by #11048
Closed

podman docker-compose healthchecks issue #10617

pclass-sensonix opened this issue Jun 9, 2021 · 9 comments · Fixed by #11048
Assignees
Labels
HTTP API Bug is in RESTful API 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

@pclass-sensonix
Copy link

I am running podman 3.1.2-dev on a custom embedded Linux device. I have a docker-compose.yml file with an application named 'app1', which is a simple Python3 Flask webserver. Podman successfully brings up the docker-compose environment, but my healthchecks always return error, regardless of what I use for timeouts, intervals, retries, etc. My defined healthcheck works when I exec into the container and run them manually. When I inspect the application with 'podman inspect app1', I can see 2 'CMD-SHELL' instances defined. I believe it should only have mine and perhaps this is the issue.

Output of podman inspect app1:

"Healthcheck": {
    "Test": [
        "CMD-SHELL",
        "CMD-SHELL /usr/bin/wget http://127.0.0.1 || exit 1"
    ],
    "StartPeriod": 300000000000,
    "Interval": 30000000000,
    "Timeout": 60000000000,
    "Retries": 5
},

"Healthcheck": {
        "Status": "unhealthy",
        "FailingStreak": 21,
        "Log": [
            {
                "Start": "2021-06-09T14:53:29.192875476Z",
                "End": "2021-06-09T14:53:31.211062949Z",
                "ExitCode": 1,
                "Output": ""
            },
            {
                "Start": "2021-06-09T14:54:07.933818178Z",
                "End": "2021-06-09T14:54:10.368276033Z",
                "ExitCode": 1,
                "Output": ""
            },
            {
                "Start": "2021-06-09T14:54:47.115168651Z",
                "End": "2021-06-09T14:54:49.119256984Z",
                "ExitCode": 1,
                "Output": ""
            },
            {
                "Start": "2021-06-09T14:55:26.183508777Z",
                "End": "2021-06-09T14:55:28.038064193Z",
                "ExitCode": 1,
                "Output": ""
            },
            {
                "Start": "2021-06-09T14:56:02.115129058Z",
                "End": "2021-06-09T14:56:03.41780082Z",
                "ExitCode": 1,
                "Output": ""
            }
        ]
    }
},

Manually running healthchecks:

root@robot:~# podman healthcheck run app1
unhealthy
root@robot:~# 
root@robot:~# podman exec -it app1 sh
/ # 
/ # /usr/bin/wget http://127.0.0.1 || exit 1
Connecting to 127.0.0.1 (127.0.0.1:80)
saving to 'index.html'
index.html           100% |*******************************************************************************|    39  0:00:00 ETA
'index.html' saved
/ # 
/ # echo $?
0
/ # exit
root@robot:~# 

root@robot:~# podman --version
podman version 3.2.1-dev
root@robot:~# 

docker-compose.yml file:

services:
  app1:
    container_name: app1
    hostname: app1
    image: app1:1.0
    build: ./app1
    init: true
    entrypoint:
      - "python3"
      - "/app/app.py"
    security_opt:
      - seccomp=unconfined
    tty: true
    healthcheck:
      test: /usr/bin/wget http://127.0.0.1 || exit 1
      interval: 30s
      timeout: 60s
      retries: 5
      start_period: 300s
    restart: always
    volumes:
      - ./app1:/app
      - ./shared_data:/shared_data
    environment:
      HEALTHCHECK_DEBUG: 1
    cpu_count: 1
    cpus: 0.95
    cpu_percent: 10
    mem_limit: 25m
    networks:
      - robot_internal_net
@mheon
Copy link
Member

mheon commented Jun 9, 2021

I see "Custom embedded system" - Podman healthchecks require the use of systemd as an init system. Does your distribution use systemd for init?

@pclass-sensonix
Copy link
Author

@mheon - Yes I use systemd. I can see the timer firing periodically to run the healthcheck.

@mheon
Copy link
Member

mheon commented Jun 9, 2021

Alright. Next best guess is that this is an issue with the Compat API for container creation - might not be translating the Docker-formatted healthchecks properly into Podman ones. @jwhonce You have time to take a look? Could also be a good one for @cdoern

@cdoern
Copy link
Contributor

cdoern commented Jun 9, 2021

I can take a look at this, it is in the same vein as #10610

edit: made some progress, narrowing down where in the compat side I think the issue is. Will follow up more tomorrow when I am sure

@cdoern cdoern self-assigned this Jun 9, 2021
@mheon mheon added kind/bug Categorizes issue or PR as related to a bug. HTTP API Bug is in RESTful API labels Jun 10, 2021
@cdoern
Copy link
Contributor

cdoern commented Jun 10, 2021

@jwhonce PTAL if you have time, not seeing any obvious issues with the compat API on this one. Healthcheck is passed in the body of the request and seems to be decoded properly.

@pclass-sensonix
Copy link
Author

@cdoern - thanks for starting to look into this. Were you able to reproduce the failing healthchecks as I described?

@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@rhatdan
Copy link
Member

rhatdan commented Jul 15, 2021

@cdoern did you ever look at this?

@cdoern
Copy link
Contributor

cdoern commented Jul 15, 2021

@rhatdan yes, I ccd @jwhonce because I didn't see any issues with the healthchecks. It is similar to #10610 but I don't think that fixed it. Will take another look.

cdoern pushed a commit to cdoern/podman that referenced this issue Jul 26, 2021
Compat healthcheck tests are of the format []string but podman's were of
the format string. Converted podman's to []string at the specgen level since it has the same effect
and removed the incorrect parsing of compat healthchecks.

fixes containers#10617

Signed-off-by: cdoern <[email protected]>
cdoern pushed a commit to cdoern/podman that referenced this issue Jul 28, 2021
Compat healthcheck tests are of the format []string but podman's were of
the format string. Converted podman's to []string at the specgen level since it has the same effect
and removed the incorrect parsing of compat healthchecks.

fixes containers#10617

Signed-off-by: cdoern <[email protected]>
@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
HTTP API Bug is in RESTful API 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.

4 participants