Skip to content

feat: support healthcheck field in service config#4869

Open
opjt wants to merge 2 commits into
containerd:mainfrom
opjt:feat/healthcheck
Open

feat: support healthcheck field in service config#4869
opjt wants to merge 2 commits into
containerd:mainfrom
opjt:feat/healthcheck

Conversation

@opjt
Copy link
Copy Markdown
Contributor

@opjt opjt commented Apr 27, 2026

Summary

services.<SERVICE>.healthcheck was listed as unimplemented — this PR wires it up.

compose-go already parses the healthcheck block, so this is mostly connecting
it to the existing --health-* flags in serviceparser.

Limitations:

  • CMD exec form is converted to CMD-SHELL since --health-cmd always stores the command as CMD-SHELL (see withHealthcheck in pkg/cmd/container/create.go)
  • start_interval is not supported — I plan to work on this after this PR is merged.

Test plan

services:
  web:
    image: nginx:alpine
    healthcheck:
      test: ["CMD-SHELL", "curl -f http://localhost"]
      interval: 10s
      timeout: 5s
      retries: 3
      start_period: 2s
  nerdctl compose up -d
  nerdctl inspect <container-name> | grep health

@opjt
Copy link
Copy Markdown
Contributor Author

opjt commented May 6, 2026

Hi, just following up on this PR. Thanks!

@AkihiroSuda AkihiroSuda added this to the v2.3.1 milestone May 10, 2026
@opjt opjt changed the title compose: support healthcheck field in service config feat: support healthcheck field in service config May 10, 2026
Comment thread pkg/composer/serviceparser/serviceparser.go Outdated
Comment thread pkg/composer/serviceparser/serviceparser.go
Comment thread pkg/composer/serviceparser/serviceparser.go Outdated
Comment thread pkg/composer/serviceparser/serviceparser.go Outdated
Comment thread cmd/nerdctl/compose/compose_up_linux_test.go
Comment thread pkg/composer/serviceparser/serviceparser_test.go Outdated
@opjt opjt force-pushed the feat/healthcheck branch 4 times, most recently from 9221952 to 6c186d2 Compare May 11, 2026 12:44
@opjt opjt requested a review from haytok May 11, 2026 12:55
Comment thread pkg/composer/serviceparser/serviceparser_test.go Outdated
Comment thread pkg/composer/serviceparser/serviceparser.go
Comment thread pkg/composer/serviceparser/serviceparser.go Outdated
opjt added 2 commits May 12, 2026 07:56
Signed-off-by: Park jungtae <jtpark1957@gmail.com>
Signed-off-by: Park jungtae <jtpark1957@gmail.com>
@opjt opjt force-pushed the feat/healthcheck branch from 6c186d2 to e51bc85 Compare May 11, 2026 23:02
@opjt opjt requested a review from haytok May 11, 2026 23:06
Copy link
Copy Markdown
Member

@haytok haytok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thanks!

@haytok haytok requested a review from AkihiroSuda May 12, 2026 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants