NGINX port incorrect after restart when using NGINX_LISTEN_PORT
n9iels opened this issue · 2 comments
Support guidelines
- I've read the support guidelines
I've found an issue and checked that ...
- ... the documentation does not mention anything about my problem
- ... there are no open or closed issues that are related to my problem
Description
When setting the NGINX_LISTEN_PORT
environment variable the port is correctly changed upon creation of the container. However, after restarting the container the default port 80
and the port set in the environment variable seems to merge and the container crashes.
Expected behaviour
The custom port should work after restarting the container.
Actual behaviour
The customly set port and the default port 80
seems to merge after restarting the container. Also the following error appears in the logs:
nginx: [emerg] invalid port in "808081" of the "listen"directive in /etc/nginx/http.d/dsmr-webinterface.conf:6
Steps to reproduce
- Create a conatiner and use the
NGINX_LISTEN_PORT
environment variable - Build and start the container. Everything should work as normal and the normal and DSMR reader is reachable on the customly set port
- Restart the container
- Observe that DSMR reader is no longer reachable and the logs show the mentioned error
Docker info
Client:
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.10.4
Path: /usr/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.17.2
Path: /usr/libexec/docker/cli-plugins/docker-compose
Server:
Containers: 3
Running: 3
Paused: 0
Stopped: 0
Images: 3
Server Version: 23.0.4
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 2806fc1057397dbaeefbea0e4e17bddfbd388f38
runc version: v1.1.5-0-gf19387a
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: builtin
cgroupns
Kernel Version: 5.15.0-70-generic
Operating System: Ubuntu 22.04.2 LTS
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 1.93GiB
Name: vps9301
ID: de0757d1-21bb-415d-9d7d-1e6c27003765
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Version
- Docker compose version (type
docker-compose --version
):v2.17.2
- System info (type
uname -a
):Linux vps9301 5.15.0-70-generic #77-Ubuntu SMP Tue Mar 21 14:02:37 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Docker compose
services:
dsmr:
image: xirixiz/dsmr-reader-docker:amd64-5.10.3-2023.03.01
container_name: dsmr
mem_limit: 521M
restart: always
network_mode: host
volumes:
- /etc/localtime:/etc/localtime:ro
- ./backups:/app/backups
environment:
- TZ=Europe/Amsterdam
- DJANGO_DATABASE_HOST=localhost
- DJANGE_DATABASE_PORT=5432
- DJANGO_DATABASE_USER=dsmrreader
- DJANGO_DATABASE_PASSWORD=xxxxxxx
- DJANGO_DATABASE_NAME=dsmrreader
- DSMRREADER_LOGLEVEL=WARNING
- DSMRREADER_ADMIN_USER=admin
- DSMRREADER_ADMIN_PASSWORD=xxxxxx
- DSMRREADER_REMOTE_DATALOGGER_MODE=receiver
- DSMRREADER_BACKUP_NAME_PREFIX=dsmrreader
- DSMRREADER_OPERATION_MODE=api_server
- NGINX_LISTEN_PORT=8081
Container logs
nginx: [emerg] invalid port in "808081" of the "listen"directive in /etc/nginx/http.d/dsmr-webinterface.conf:6
Additional info
No response
Ah yes, ofcourse. I just fixed it (try at least). A new release will be available soon.
Ja, ik denk dat ik het hele nginx config stuk eruit ga slopen. Het is denk ik beter dat wanneer je een specifieke config wenst, dat je die dan mount in de container. Het geknip en geplak met bash is onbetrouwbaar helaas.
Rolling back.