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

wget used by container health check does not respect 'no_proxy' environment variable. #1040

Closed
arusuki opened this issue Jul 30, 2024 · 2 comments

Comments

@arusuki
Copy link

arusuki commented Jul 30, 2024

LRR Version and OS
LRRVersion: 0.9.21
OS: Synology DSM 7.1-42661
Installation method: Docker Container

Summary
The LRR container uses wget to check its health status, while the wget shipped with alpine image is from busybox which does not respect the no_proxy environment variable.

Therefore, when http_proxy and https_proxy environment variables are set, the wget command launched by docker health check uses proxy to access http://localhost:3000 and fails the test. The docker ps command therefore reports LRR container in unhealthy state which is false positive.

Possible Solutions

  • add apk add wget to Dockerfile, which installs GNU wget which understands no_proxy, or
  • add -Y off option to wget command to force busybox wget ignoring proxies when performing health check.

To Reproduce

When http_proxy and https_proxy environment variables are set, command docker ps shows the LRR container in unhealthy states.

CONTAINER ID   IMAGE                                 COMMAND                  CREATED          STATUS                      PORTS
3a9f9661f76d   difegue/lanraragi:latest              "//init"                 59 minutes ago   Up 23 minutes (unhealthy)   0.0.0.0:3000->3000/tcp                                    

To verify further, running command docker exec -it <LRR container ID> sh gives a shell in LRR container, then test the wget used by health check.

#inspect proxy settings
/home/koyomi/lanraragi # echo $http_proxy
http://172.28.0.1:7890
/home/koyomi/lanraragi # echo $https_proxy
http://172.28.0.1:7890
/home/koyomi/lanraragi # echo $no_proxy
localhost,127.0.0.1

#check health
/home/koyomi/lanraragi # wget --quiet --tries=1 --no-check-certificate --spider http://localhost:3000
wget: server returned error: HTTP/1.1 502 Bad Gateway

#Force wget to ignore proxy
/home/koyomi/lanraragi # wget --quiet --tries=1 --no-check-certificate --spider -Y off http://localhost:3000
/home/koyomi/lanraragi # echo $?
0

#install GNU wget
/home/koyomi/lanraragi # apk add wget
/home/koyomi/lanraragi # wget --quiet --tries=1 --no-check-certificate --spider http://localhost:3000
/home/koyomi/lanraragi # echo $?
0
@Difegue
Copy link
Owner

Difegue commented Jul 30, 2024

That makes sense to me. Thanks for the detailed explanation!

@holopin-bot @arusuki give-him-the-burg

Copy link

holopin-bot bot commented Jul 30, 2024

Congratulations @arusuki, the maintainer of this repository has issued you a badge! Here it is: https://holopin.io/claim/clz8ozi2k89330cjsu7o6pwrc

This badge can only be claimed by you, so make sure that your GitHub account is linked to your Holopin account. You can manage those preferences here: https://holopin.io/account.
Or if you're new to Holopin, you can simply sign up with GitHub, which will do the trick!

@Difegue Difegue closed this as completed Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants