nginxinc / docker-nginx

Official NGINX Dockerfiles
BSD 2-Clause "Simplified" License
3.25k stars 1.73k forks source link

template can't use default variables #938

Open wcollin opened 3 days ago

wcollin commented 3 days ago

docker-compose.yaml: version: '3'

services: web: image: nginx volumes:

templates/default.conf.template: server { listen ${NGINX_PORT:-8080}; server_name localhost;

location / {
    root   /usr/share/nginx/html;
    index  index.html index.htm;
}

error_page   500 502 503 504  /50x.html;
location = /50x.html {
    root   /usr/share/nginx/html;
}

}

error: /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh 10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf 10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh 20-envsubst-on-templates.sh: Running envsubst on /etc/nginx/templates/default.conf.template to /etc/nginx/conf.d/default.conf /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh /docker-entrypoint.sh: Configuration complete; ready for start up 2024/10/16 06:35:14 [emerg] 1#1: invalid port in "${NGINX_PORT:-8080}" of the "listen" directive in /etc/nginx/conf.d/default.conf:2 nginx: [emerg] invalid port in "${NGINX_PORT:-8080}" of the "listen" directive in /etc/nginx/conf.d/default.conf:2

oxpa commented 3 days ago

Templates are using envsubst tool so it is expected behavior.