I assume you meant curl
instead of wget
. The process is executed inside the container with whatever USER is declared. The commands executed by the healtcheck must exist in the container.
The exit code of the last command is relevant and either needs to be 0 (=passed) or 1 (=failed).
if curl is able to make the request, the command is considered successful regardless of the http status code, and it exits with exit code 0.
If curl fails to make the request, it will return one of the error codes from the url you shared, but the || exit 1
makes sure that instead of returning any non zero exit code directly, it exits with exit code 1. The ||
is sh/bash syntax for logical OR, which will be evaluated, if the previous command did not return exist code 0.