You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The NGINX container documentation mentions an NGINX_PORT environment variable.
However, there appears to be no mention of this variable in the container code.
This can be confusing when trying to change the default port 80 to another one using this variable, as the NGINX container continues to expose port 80.
This causes problems when paired with the Traefik proxy, which uses the lowest-exposed port.
Expected Behavior
When I set env variable NGINX_PORT to 8080, the only exposed port is 8080.
Steps to Reproduce the Bug
execute : docker run -d -e NGINX_PORT=8080 nginx
the result is :
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f48cd10e623e nginx "/docker-entrypoint.…" 2 seconds ago Up 2 seconds 80/tcp nostalgic_spence
the result should be :
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f48cd10e623e nginx "/docker-entrypoint.…" 2 seconds ago Up 2 seconds 8080/tcp nostalgic_spence
Environment Details
Version/release of Docker and method of installation (e.g. Docker Desktop / Docker Server)
Version of the Docker NGINX image or specific commit: [e.g. 1.4.3/commit hash]
I think I have misunderstood the documentation, reading "Using environment variables in nginx configuration (new in 1.19)" in https://hub.docker.com/_/nginx
It could be an error or mistake to show NGINX_PORT variable in documentation if it is not used by the container, it's confusing.
providing a variable who can change the default port is a real feature envy !
The text was updated successfully, but these errors were encountered:
NGINX_PORT is used to showcase template function in the image. By default there is no default.conf.template in the image.
You will have to create a template before using it.
Bug Overview
The NGINX container documentation mentions an NGINX_PORT environment variable.
However, there appears to be no mention of this variable in the container code.
This can be confusing when trying to change the default port 80 to another one using this variable, as the NGINX container continues to expose port 80.
This causes problems when paired with the Traefik proxy, which uses the lowest-exposed port.
Expected Behavior
When I set env variable NGINX_PORT to 8080, the only exposed port is 8080.
Steps to Reproduce the Bug
execute :
docker run -d -e NGINX_PORT=8080 nginx
the result is :
the result should be :
Environment Details
Additional Context
I think I have misunderstood the documentation, reading "Using environment variables in nginx configuration (new in 1.19)" in https://hub.docker.com/_/nginx
It could be an error or mistake to show NGINX_PORT variable in documentation if it is not used by the container, it's confusing.
providing a variable who can change the default port is a real feature envy !
The text was updated successfully, but these errors were encountered: