Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker health check is not working when using a proxy #7529

Closed
1 task done
MatthiasJobst opened this issue Aug 15, 2023 · 0 comments · Fixed by MatthiasJobst/gogs#1 · May be fixed by #7532
Closed
1 task done

Docker health check is not working when using a proxy #7529

MatthiasJobst opened this issue Aug 15, 2023 · 0 comments · Fixed by MatthiasJobst/gogs#1 · May be fixed by #7532
Labels
💊 bug Something isn't working

Comments

@MatthiasJobst
Copy link

Gogs version

0.14.0+dev

Git version

  • Server: 2.38.5
  • Client: 2.39.1.windows.1

Operating system

Alpine 3.17

Database

SQLite 3

Describe the bug

This problem exists when using a docker image in a corporate environment. Running docker psyields:
gogs/gogs "/app/gogs/docker/st..." 5 days ago Up 8 minutes (unhealthy)

The reason is that in the health check curl is looking for localhost with a specific port. I assume that the proxy is called to resolve localhost:3000. This is correctly resolved, but by changing the port to 10880 -p 10880:3000 when connecting externally, the curl will not be fulfilled. The health check reports unhealthy.

To reproduce

The problem occurs when using a proxy to connect to the internet. This can be achieved with running the docker image using the parameter:
-e HTTP_PROXY="host.docker.internal" -e HTTPS_PROXY="host.docker.internal"

Expected behavior

It is expected that docker ps shows the container as healthy.

Additional context

In the Dockerfile the health check should be written as:
HEALTHCHECK CMD (curl --noproxy localhost -o /dev/null -sS http://localhost:3000/healthcheck) || exit 1

Code of Conduct

  • I agree to follow this project's Code of Conduct
@MatthiasJobst MatthiasJobst added the 💊 bug Something isn't working label Aug 15, 2023
MatthiasJobst added a commit to MatthiasJobst/gogs that referenced this issue Aug 16, 2023
Add --noproxy for localhost to prevent from using a proxy for this request
MatthiasJobst added a commit to MatthiasJobst/gogs that referenced this issue Aug 16, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
💊 bug Something isn't working
Projects
None yet
1 participant