Go listens on any unspecified address with one socket that answers IPv4 and IPv6, so BIND_ADDRESS=0.0.0.0 also bound every IPv6 address, which the README says it does not. The listener now uses tcp4 for an IPv4 address, written plain or IPv4-mapped; :: still binds both. The server's start hook suppresses contextcheck, as the other start hooks do. The image's health check asked for localhost, which wget reached over ::1 only. It now asks for the container's own address: its IPv4 address, or its IPv6 address on an IPv6-only network. A loopback bind answers neither. The README says such a network needs ::, drops the bindv6only condition from :: (Go sets that socket option itself) and names an ss check. Model: opus-5-5
This commit is contained in:
+10
-1
@@ -274,8 +274,17 @@ EXPOSE 8080
|
||||
# port.
|
||||
ENV BIND_ADDRESS=0.0.0.0
|
||||
|
||||
# The probe requests the container's own address, not loopback, so a
|
||||
# listener that answers only on loopback (an empty or loopback
|
||||
# BIND_ADDRESS) fails it. On a network with IPv4, hostname -i prints the
|
||||
# container's IPv4 address, which 0.0.0.0 and :: both answer. On an
|
||||
# IPv6-only network it prints none, and the probe requests the IPv6
|
||||
# address /etc/hosts lists under the container's hostname instead, which
|
||||
# only :: answers.
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||
CMD wget --no-verbose --tries=1 --spider http://localhost:8080/.well-known/healthcheck || exit 1
|
||||
CMD addr="$(hostname -i 2>/dev/null | cut -d ' ' -f 1)"; \
|
||||
[ -n "$addr" ] || addr="[$(getent hosts "$(hostname)" | cut -d ' ' -f 1)]"; \
|
||||
wget --no-verbose --tries=1 --spider "http://$addr:8080/.well-known/healthcheck" || exit 1
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
||||
CMD ["/app/webhooker"]
|
||||
|
||||
Reference in New Issue
Block a user