Skip to content

[Bug]: Healthcheck not working on resources with build pack Dockerfile #5394

@JoBurgard

Description

@JoBurgard

Error Message and Logs

I have a dockerfile for a postgres instance on Coolify. But I cannot use a healthcheck as it does not work when it deploys.

I tested it locally and the healthcheck works. There are logs in State.Health.Status and everything is fine. Sadly it does not work in Coolify.

New container started.
Custom healthcheck found, skipping default healthcheck.
Waiting for healthcheck to pass on the new container.
Healthcheck URL (inside the container): GET: http://localhost:5432/
Waiting for the start period (10 seconds) before starting healthcheck.
[CMD]: docker inspect --format='{{json .State.Health.Status}}' xyz-091355996505
"starting"
[CMD]: docker inspect --format='{{json .State.Health.Log}}' xyz-091355996505
[]
Attempt 1 of 3 | Healthcheck status: "starting"
[CMD]: docker inspect --format='{{json .State.Health.Status}}' xyz-091355996505
"starting"
[CMD]: docker inspect --format='{{json .State.Health.Log}}' xyz-091355996505
[]
Attempt 2 of 3 | Healthcheck status: "starting"
[CMD]: docker inspect --format='{{json .State.Health.Status}}' xyz-091355996505
"starting"
[CMD]: docker inspect --format='{{json .State.Health.Log}}' xyz-091355996505
[]
Attempt 3 of 3 | Healthcheck status: "starting"
----------------------------------------
Container logs:
[CMD]: docker logs -n 100 xyz-091355996505
PostgreSQL Database directory appears to contain a database; Skipping initialization
2025-03-22 09:14:09.415 UTC [1] LOG:  starting PostgreSQL 17.0 (Debian 17.0-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
2025-03-22 09:14:09.415 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2025-03-22 09:14:09.415 UTC [1] LOG:  listening on IPv6 address "::", port 5432
2025-03-22 09:14:09.436 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2025-03-22 09:14:09.455 UTC [27] LOG:  database system was interrupted; last known up at 2025-03-22 09:02:48 UTC
2025-03-22 09:14:12.171 UTC [27] LOG:  database system was not properly shut down; automatic recovery in progress
2025-03-22 09:14:12.203 UTC [27] LOG:  invalid record length at 0/654B5520: expected at least 24, got 0
2025-03-22 09:14:12.203 UTC [27] LOG:  redo is not required
2025-03-22 09:14:12.222 UTC [25] LOG:  checkpoint starting: end-of-recovery immediate wait
2025-03-22 09:14:12.291 UTC [25] LOG:  checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.016 s, sync=0.013 s, total=0.078 s; sync files=2, longest=0.011 s, average=0.007 s; distance=0 kB, estimate=0 kB; lsn=0/654B5520, redo lsn=0/654B5520
2025-03-22 09:14:12.302 UTC [1] LOG:  database system is ready to accept connections
----------------------------------------
Removing old containers.
----------------------------------------
WARNING: Dockerfile or Docker Image based deployment detected. The healthcheck needs a curl or wget command to check the health of the application. Please make sure that it is available in the image or turn off healthcheck on Coolify's UI.
----------------------------------------
New container is not healthy, rolling back to the old container. 

Steps to Reproduce

  1. Create a resource with build pack dockerfile.
  2. The dockerfile can be like this:
FROM postgres:17.0

HEALTHCHECK --interval=1m --timeout=30s --retries=3 \
  CMD pg_isready
  1. Try to deploy.
  2. It fails on the healthcheck.

Example Repository URL

No response

Coolify Version

v4.0.0-beta.397

Are you using Coolify Cloud?

No (self-hosted)

Operating System and Version (self-hosted)

No response

Additional Information

If I can provide further assistance, let me know. 🙂

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions