fix: default to 0.0.0.0 instead of [::] for broader compatibility

This commit is contained in:
Benoit Chesneau 2026-01-23 19:19:38 +01:00
parent 6a83feecd6
commit 076bef68d3
3 changed files with 5 additions and 6 deletions

View File

@ -17,8 +17,8 @@ COPY docker/docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
# Configuration via environment:
# GUNICORN_BIND - full bind address (default: [::]:8000, IPv4+IPv6)
# GUNICORN_HOST - bind host (default: [::])
# GUNICORN_BIND - full bind address (default: 0.0.0.0:8000)
# GUNICORN_HOST - bind host (default: 0.0.0.0)
# GUNICORN_PORT - bind port (default: 8000)
# GUNICORN_WORKERS - number of workers (default: 2 * CPU + 1)
# GUNICORN_ARGS - additional arguments (e.g., "--timeout 120")

View File

@ -6,9 +6,8 @@ if [ "${1:0:1}" = '-' ] || [ -z "${1##*:*}" ]; then
# First arg is a flag or contains ':' (app:callable), run gunicorn
# Build bind address from GUNICORN_HOST and GUNICORN_PORT, or use GUNICORN_BIND
# Default: listen on both IPv4 and IPv6
PORT="${GUNICORN_PORT:-8000}"
BIND="${GUNICORN_BIND:-${GUNICORN_HOST:-[::]}:${PORT}}"
BIND="${GUNICORN_BIND:-${GUNICORN_HOST:-0.0.0.0}:${PORT}}"
# Add bind if not specified in args or GUNICORN_ARGS
if [[ ! " $* $GUNICORN_ARGS " =~ " --bind " ]] && [[ ! " $* $GUNICORN_ARGS " =~ " -b " ]] && [[ ! "$* $GUNICORN_ARGS" =~ --bind= ]] && [[ ! "$* $GUNICORN_ARGS" =~ -b= ]]; then

View File

@ -48,8 +48,8 @@ docker rm myapp
| Variable | Description | Default |
|----------|-------------|---------|
| `GUNICORN_BIND` | Full bind address | `[::]:8000` (IPv4+IPv6) |
| `GUNICORN_HOST` | Bind host | `[::]` |
| `GUNICORN_BIND` | Full bind address | `0.0.0.0:8000` |
| `GUNICORN_HOST` | Bind host | `0.0.0.0` |
| `GUNICORN_PORT` | Bind port | `8000` |
| `GUNICORN_WORKERS` | Number of workers | `(2 * CPU) + 1` |
| `GUNICORN_ARGS` | Additional arguments | (none) |