Skip to content

Conversation

@iamgurjitsingh
Copy link
Contributor

The HEALTHCHECK command in the Dockerfile was using curl, but curl is not available by default in the nginx:stable-alpine base image. This caused the health checks to always fail.

This commit adds curl installation using apk to ensure the healthcheck works correctly.

The HEALTHCHECK command in the Dockerfile was using curl, but curl is not
available by default in the nginx:stable-alpine base image. This caused
the health checks to always fail.
This commit adds curl installation using apk to ensure the healthcheck
works correctly.
@azurejelly
Copy link
Contributor

curl is already available by default on nginx:stable-alpine:

$ docker run -it --name "nginx" -d -p 80:80 nginx:stable-alpine
ffb7bdd44673dbe9997be335055036d14f0bedef955efed280ebc495ccd1b34a

$ docker exec -it nginx /bin/sh
/ # curl
curl: try 'curl --help' or 'curl --manual' for more information
/ # 

plus, the healthcheck does work:

root@marisa:~# docker inspect --format='{{json .State.Health}}' vert | jq
{
  "Status": "healthy",
  "FailingStreak": 0,
  "Log": [
    {
      "Start": "2025-12-03T12:09:59.497996692Z",
      "End": "2025-12-03T12:09:59.552074748Z",
      "ExitCode": 0,
      "Output": ""
    },
    {
      "Start": "2025-12-03T12:10:29.554858192Z",
      "End": "2025-12-03T12:10:29.599120287Z",
      "ExitCode": 0,
      "Output": ""
    },
    {
      "Start": "2025-12-03T12:10:59.600134551Z",
      "End": "2025-12-03T12:10:59.650502304Z",
      "ExitCode": 0,
      "Output": ""
    },
    {
      "Start": "2025-12-03T12:11:29.650982581Z",
      "End": "2025-12-03T12:11:29.69597203Z",
      "ExitCode": 0,
      "Output": ""
    },
    {
      "Start": "2025-12-03T12:11:59.697033642Z",
      "End": "2025-12-03T12:11:59.75156943Z",
      "ExitCode": 0,
      "Output": ""
    }
  ]
}

@iamgurjitsingh iamgurjitsingh deleted the fix/docker-healthcheck-curl-missing branch December 3, 2025 12:20
@iamgurjitsingh
Copy link
Contributor Author

Thanks @azurejelly I also verify the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants