microsoft / microsoft/aspire

Support docker healthchecks

Open
#8,208 4 comments 1 reaction 0 assignees View on GitHub
area-app-model area-orchestrator docker-compose
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

container images can have a healthchecks provided https://docs.docker.com/reference/dockerfile/#healthcheck

when the container is started, docker will call it and make the state available like so:

```
docker inspect --format='{{json .State.Health}}' 56c0067882aa
{"Status":"healthy","FailingStreak":0,"Log":[{"Start":"2025-03-20T10:08:53.524705545Z","End":"2025-03-20T10:08:53.588649253Z","ExitCode":0,"Output":""},{"Start":"2025-03-20T10:09:23.592720711Z","End":"2025-03-20T10:09:23.643875336Z","ExitCode":0,"Output":""},{"Start":"2025-03-20T10:09:53.646527211Z","End":"2025-03-20T10:09:53.695310628Z","ExitCode":0,"Output":""},{"Start":"2025-03-20T10:10:23.696539837Z","End":"2025-03-20T10:10:23.742670003Z","ExitCode":0,"Output":""},{"Start":"2025-03-20T10:10:53.745960878Z","End":"2025-03-20T10:10:53.795057462Z","ExitCode":0,"Output":""}]}
```

when a healthchecks is made available like this, it is executable based (no http endpoint available)

### Describe the solution you'd like

it would be really nice if Aspire could support these docker provided healthchecks natively or allow Aspire healthchecks that call into the container executables themselves.

I investigated a little bit and it is pretty hard to get the container id or name from Aspire due to DcpInstancesAnnotation being internal.

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.