docker-nginx
docker-nginx copied to clipboard
template can't use default variables
docker-compose.yaml: version: '3'
services: web: image: nginx volumes: - ./templates:/etc/nginx/templates ports: - "8080:8080"
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
Templates are using envsubst tool so it is expected behavior.
thanks,i set default variables in Dockerfile ENV NGINX_PORT
Thanks for the update!