Skip to content

Conversation

@MPK1
Copy link

@MPK1 MPK1 commented Jan 18, 2026

add healthcheck to dockerfiles, fixes #36403

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jan 18, 2026
@TheFox0x7
Copy link
Contributor

there was a previous PR for this.
The issue that was brought up is that the /healthz doesn't really report issues that gitea restart would resolve - only if database and cache are reachable.

@MPK1
Copy link
Author

MPK1 commented Jan 18, 2026

Thanks, I just read the old conversation. I would argue that it is not necessarily the job of /healthz to tell you about issues that a restart will solve. In my opinion, it's already quite useful to let you know if the container started successfully or to notify another layer that the container crashed after a period of successful operation. By default, the Docker daemon will not do anything, such as restarting the container. Only Docker Swarm or Kubernetes can perform automatic restarts, afaik. So for me, this is more like a basic monitoring thing. I also want to get notified if Gitea has an issue where a simple restart does not help.

So, as I understand, this change might break setups configured to automatically restart unhealthy containers. Maybe we can come up with another solution, like adding something to the docs that explains the endpoint and how to use it with plain Docker or Docker Compose for monitoring.

Modifying the endpoint to just return an "unhealthy" if the detected issue is solvable via a restart seems quite unrealistic to me.

@wxiaoguang
Copy link
Contributor

If you believe it helps your case and you can handle the potential bugs by yourself, you can use the official image as base image and build your own image with that health check

But for most end users, it can't be done like this.

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

Labels

lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. modifies/internal

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dockerfile HEALTHCHECK integration

4 participants