{"id":19419535,"url":"https://github.com/eexit/curl-healthchecker","last_synced_at":"2026-05-12T23:02:11.673Z","repository":{"id":136624524,"uuid":"372611083","full_name":"eexit/curl-healthchecker","owner":"eexit","description":"A cURL HTTP-only ultra-slim binary Docker image provider for your FROM scratch Docker image healthchecks","archived":false,"fork":false,"pushed_at":"2021-05-31T21:58:40.000Z","size":2,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-25T03:44:22.262Z","etag":null,"topics":["curl","docker-image","dockerfile","health-check","healthcheck"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/repository/docker/eexit/curl-healthchecker","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eexit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-31T19:36:12.000Z","updated_at":"2024-08-24T22:53:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"f82bd403-f9a9-43f0-bb35-308a6ca403e0","html_url":"https://github.com/eexit/curl-healthchecker","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/eexit/curl-healthchecker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eexit%2Fcurl-healthchecker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eexit%2Fcurl-healthchecker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eexit%2Fcurl-healthchecker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eexit%2Fcurl-healthchecker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eexit","download_url":"https://codeload.github.com/eexit/curl-healthchecker/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eexit%2Fcurl-healthchecker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32960295,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-12T09:19:52.626Z","status":"ssl_error","status_checked_at":"2026-05-12T09:17:33.438Z","response_time":102,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["curl","docker-image","dockerfile","health-check","healthcheck"],"created_at":"2024-11-10T13:18:08.663Z","updated_at":"2026-05-12T23:02:11.636Z","avatar_url":"https://github.com/eexit.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cURL healthchecker [![Docker Image Size (latest by date)](https://img.shields.io/docker/image-size/eexit/curl-healthchecker?style=flat-square)](https://hub.docker.com/repository/docker/eexit/curl-healthchecker)\n\nLatelely, I'm trying to set-up `HEALTHCHECK` to my Docker images and since I have many Go projects that run from scratch, I needed to find a way to test the health of my Go APIs.\n\nAt first, I tried to compile and build a binary like this:\n\n```go\npackage main\n\nimport (\n\t\"net/http\"\n\t\"os\"\n)\n\nfunc main() {\n\tcode := 0\n\tresp, err := http.Head(\"http://localhost/healthcheck\")\n\tif err != nil || resp.StatusCode != http.StatusOK || resp.StatusCode != http.StatusNoContent {\n\t\tcode = 1\n\t}\n\tos.Exit(code)\n}\n```\n\nBut even after compression (using [upx](https://upx.github.io/)), the binary is still 3.3M. Still too much for what it is.\n\nAfter some digging and testing, I managed to build my own cURL binary with the bare mininum to handle a basic HTTP healthcheck request:\n\n```bash\n$ docker run --rm eexit/curl-healthchecker:v1.0.0 -V\ncurl 7.77.0 (x86_64-pc-linux-musl) libcurl/7.77.0\nRelease-Date: 2021-05-26\nProtocols: http\nFeatures: Largefile\n```\n\nThe binary size is 194K, which is pretty slim.\n\n## Usage\n\nYou only need to add 3 lines in your Dockerfile:\n\n```dockerfile\nFROM eexit/curl-healthchecker:v1.0.0 AS curl\n# Other stages...\n\nFROM scratch\nCOPY --from=curl /curl /\n# Copy from other stages...\n\n# Supposed your healthcheck endpoint is http://127.0.0.1/healthcheck\nHEALTHCHECK --interval=5s --timeout=2s --retries=3 \\\n    CMD [\"/curl\", \"-fIA\", \"cURL healthcheck\", \"http://127.0.0.1/healthcheck\"]\n```\n\nOnce you've up'd your container, the  health status is shown in the `docker ps` output:\n\n```\nCONTAINER ID   IMAGE                           COMMAND                  CREATED          STATUS                    PORTS                                                                                  NAMES\nf6429b2318d3   eexit/http2smtp                 \"/http2smtp\"             29 seconds ago   Up 26 seconds (healthy)   80/tcp, 0.0.0.0:80-\u003e8080/tcp, :::80-\u003e8080/tcp                                          http2smtp_http2smtp_1\n```\n\nIf you wish to troubleshoot:\n\n```bash\ndocker inspect --format \"{{json .State.Health }}\" f6429b2318d3 | jq .\n{\n  \"Status\": \"healthy\",\n  \"FailingStreak\": 0,\n  \"Log\": [\n    {\n      \"Start\": \"2021-05-31T20:34:47.239507658Z\",\n      \"End\": \"2021-05-31T20:34:47.328378157Z\",\n      \"ExitCode\": 0,\n      \"Output\": \"  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\\n                                 Dload  Upload   Total   Spent    Left  Speed\\n\\r  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0\\r  0    25    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0\\nHTTP/1.1 200 OK\\r\\nContent-Type: application/json\\r\\nDate: Mon, 31 May 2021 20:34:47 GMT\\r\\nContent-Length: 25\\r\\n\\r\\n\"\n    }\n  ]\n}\n```\n\n\n\n---\n\nInspired from:\n\n- https://medium.com/axiomzenteam/combining-docker-multi-stage-builds-and-health-checks-feea7cd2d85e\n- https://github.com/hectorm/docker-curl\n- https://github.com/moparisthebest/static-curl\n- https://github.com/dtschan/curl-static\n- https://github.com/curl/curl\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feexit%2Fcurl-healthchecker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feexit%2Fcurl-healthchecker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feexit%2Fcurl-healthchecker/lists"}