Thanks for making Mosquitto work with environment variables. Much less pain.
I notice that efrecon/mosquitto:latest on dockerhub is pointing at version 1.6.8 which is quite old.
I can see there is a tag for 2.15 however it seems to be broken. It complains it can't write a PID file and there are a bunch of missing sections of config.
[docker-entrypoint] [info] [20230304-231946] Environment resolution in section configuration at /mosquitto/config/sections/logging.conf
[docker-entrypoint] [info] [20230304-231946] Configuring 'log_dest' from env: stderr
[docker-entrypoint] [info] [20230304-231946] Environment resolution in section configuration at /mosquitto/config/sections/persistence.conf
[docker-entrypoint] [info] [20230304-231946] Configuring 'autosave_interval' from env: 100
[docker-entrypoint] [info] [20230304-231946] Environment resolution in section configuration at /mosquitto/config/sections/persistence.conf
[docker-entrypoint] [info] [20230304-231946] Configuring 'persistence_location' from env: /mosquitto/data/
[docker-entrypoint] [info] [20230304-231946] Environment resolution in section configuration at /mosquitto/config/sections/persistence.conf
[docker-entrypoint] [info] [20230304-231946] Configuring 'persistence' from env: true
[docker-entrypoint] [info] [20230304-231946] PID file at /var/run/mosquitto.pid
[docker-entrypoint] [WARN] [20230304-231946] Section default does not exist under /mosquitto/config/sections
[docker-entrypoint] [WARN] [20230304-231946] Section default does not exist under /mosquitto/config/sections
[docker-entrypoint] [WARN] [20230304-231946] Section extra does not exist under /mosquitto/config/sections
[docker-entrypoint] [WARN] [20230304-231946] Section extra does not exist under /mosquitto/config/sections
[docker-entrypoint] [info] [20230304-231946] Running: /usr/sbin/mosquitto
1677971986: Loading config file /mosquitto/config/sections/bridges.conf
1677971986: Loading config file /mosquitto/config/sections/logging.conf
1677971986: Loading config file /mosquitto/config/sections/persistence.conf
1677971986: Loading config file /mosquitto/config/sections/security.conf
1677971986: Error: Unable to write pid file.
[docker-entrypoint] [info] [20230304-231948] Environment resolution in main configuration at /mosquitto/config/mosquitto.conf
[docker-entrypoint] [info] [20230304-231948] Configuring 'include_dir' from env: /mosquitto/config/sections
Looking for inclusion directory in /mosquitto/config/mosquitto.conf
[docker-entrypoint] [info] [20230304-231948] Slicing /mosquitto/config/mosquitto.conf to sections at /mosquitto/config/sections
Looking for inclusion directory in /mosquitto/config/mosquitto.conf
Keeping backup at /mosquitto/config/mosquitto.conf.bak
[docker-entrypoint] [info] [20230304-231948] Environment resolution in section configuration at /mosquitto/config/sections/persistence.conf
[docker-entrypoint] [info] [20230304-231948] Configuring 'autosave_on_changes' from env: true
[docker-entrypoint] [info] [20230304-231948] Environment resolution in section configuration at /mosquitto/config/sections/logging.conf
[docker-entrypoint] [info] [20230304-231948] Configuring 'log_dest' from env: stderr
[docker-entrypoint] [info] [20230304-231948] Environment resolution in section configuration at /mosquitto/config/sections/persistence.conf
[docker-entrypoint] [info] [20230304-231948] Configuring 'autosave_interval' from env: 100
[docker-entrypoint] [info] [20230304-231948] Environment resolution in section configuration at /mosquitto/config/sections/persistence.conf
[docker-entrypoint] [info] [20230304-231948] Configuring 'persistence_location' from env: /mosquitto/data/
[docker-entrypoint] [info] [20230304-231948] Environment resolution in section configuration at /mosquitto/config/sections/persistence.conf
[docker-entrypoint] [info] [20230304-231948] Configuring 'persistence' from env: true
[docker-entrypoint] [info] [20230304-231948] PID file at /var/run/mosquitto.pid
[docker-entrypoint] [WARN] [20230304-231948] Section default does not exist under /mosquitto/config/sections
[docker-entrypoint] [WARN] [20230304-231948] Section default does not exist under /mosquitto/config/sections
[docker-entrypoint] [WARN] [20230304-231948] Section extra does not exist under /mosquitto/config/sections
[docker-entrypoint] [WARN] [20230304-231948] Section extra does not exist under /mosquitto/config/sections
[docker-entrypoint] [info] [20230304-231948] Running: /usr/sbin/mosquitto
1677971988: Loading config file /mosquitto/config/sections/bridges.conf
1677971988: Loading config file /mosquitto/config/sections/logging.conf
1677971988: Loading config file /mosquitto/config/sections/persistence.conf
1677971988: Loading config file /mosquitto/config/sections/security.conf
1677971988: Error: Unable to write pid file.
[docker-entrypoint] [info] [20230304-231952] Environment resolution in main configuration at /mosquitto/config/mosquitto.conf
[docker-entrypoint] [info] [20230304-231952] Configuring 'include_dir' from env: /mosquitto/config/sections
Looking for inclusion directory in /mosquitto/config/mosquitto.conf
[docker-entrypoint] [info] [20230304-231952] Slicing /mosquitto/config/mosquitto.conf to sections at /mosquitto/config/sections
Looking for inclusion directory in /mosquitto/config/mosquitto.conf
Keeping backup at /mosquitto/config/mosquitto.conf.bak
[docker-entrypoint] [info] [20230304-231952] Environment resolution in section configuration at /mosquitto/config/sections/persistence.conf
[docker-entrypoint] [info] [20230304-231952] Configuring 'autosave_on_changes' from env: true
[docker-entrypoint] [info] [20230304-231952] Environment resolution in section configuration at /mosquitto/config/sections/logging.conf
[docker-entrypoint] [info] [20230304-231952] Configuring 'log_dest' from env: stderr
[docker-entrypoint] [info] [20230304-231952] Environment resolution in section configuration at /mosquitto/config/sections/persistence.conf
[docker-entrypoint] [info] [20230304-231952] Configuring 'autosave_interval' from env: 100
[docker-entrypoint] [info] [20230304-231952] Environment resolution in section configuration at /mosquitto/config/sections/persistence.conf
[docker-entrypoint] [info] [20230304-231952] Configuring 'persistence_location' from env: /mosquitto/data/
[docker-entrypoint] [info] [20230304-231952] Environment resolution in section configuration at /mosquitto/config/sections/persistence.conf
[docker-entrypoint] [info] [20230304-231952] Configuring 'persistence' from env: true
[docker-entrypoint] [info] [20230304-231952] PID file at /var/run/mosquitto.pid
[docker-entrypoint] [WARN] [20230304-231952] Section default does not exist under /mosquitto/config/sections
[docker-entrypoint] [WARN] [20230304-231952] Section default does not exist under /mosquitto/config/sections
[docker-entrypoint] [WARN] [20230304-231952] Section extra does not exist under /mosquitto/config/sections
[docker-entrypoint] [WARN] [20230304-231952] Section extra does not exist under /mosquitto/config/sections
[docker-entrypoint] [info] [20230304-231952] Running: /usr/sbin/mosquitto
1677971992: Loading config file /mosquitto/config/sections/bridges.conf
1677971992: Loading config file /mosquitto/config/sections/logging.conf
1677971992: Loading config file /mosquitto/config/sections/persistence.conf
1677971992: Loading config file /mosquitto/config/sections/security.conf
1677971992: Error: Unable to write pid file.
[docker-entrypoint] [info] [20230304-231959] Environment resolution in main configuration at /mosquitto/config/mosquitto.conf
[docker-entrypoint] [info] [20230304-231959] Configuring 'include_dir' from env: /mosquitto/config/sections
Looking for inclusion directory in /mosquitto/config/mosquitto.conf
[docker-entrypoint] [info] [20230304-231959] Slicing /mosquitto/config/mosquitto.conf to sections at /mosquitto/config/sections
Looking for inclusion directory in /mosquitto/config/mosquitto.conf
Keeping backup at /mosquitto/config/mosquitto.conf.bak
[docker-entrypoint] [info] [20230304-231959] Environment resolution in section configuration at /mosquitto/config/sections/persistence.conf
[docker-entrypoint] [info] [20230304-231959] Configuring 'autosave_on_changes' from env: true
[docker-entrypoint] [info] [20230304-231959] Environment resolution in section configuration at /mosquitto/config/sections/logging.conf
[docker-entrypoint] [info] [20230304-231959] Configuring 'log_dest' from env: stderr
[docker-entrypoint] [info] [20230304-231959] Environment resolution in section configuration at /mosquitto/config/sections/persistence.conf
[docker-entrypoint] [info] [20230304-231959] Configuring 'autosave_interval' from env: 100
[docker-entrypoint] [info] [20230304-231959] Environment resolution in section configuration at /mosquitto/config/sections/persistence.conf
[docker-entrypoint] [info] [20230304-231959] Configuring 'persistence_location' from env: /mosquitto/data/
[docker-entrypoint] [info] [20230304-231959] Environment resolution in section configuration at /mosquitto/config/sections/persistence.conf
[docker-entrypoint] [info] [20230304-231959] Configuring 'persistence' from env: true
[docker-entrypoint] [info] [20230304-231959] PID file at /var/run/mosquitto.pid
[docker-entrypoint] [WARN] [20230304-231959] Section default does not exist under /mosquitto/config/sections
[docker-entrypoint] [WARN] [20230304-231959] Section default does not exist under /mosquitto/config/sections
[docker-entrypoint] [WARN] [20230304-231959] Section extra does not exist under /mosquitto/config/sections
[docker-entrypoint] [WARN] [20230304-231959] Section extra does not exist under /mosquitto/config/sections
[docker-entrypoint] [info] [20230304-231959] Running: /usr/sbin/mosquitto
1677971999: Loading config file /mosquitto/config/sections/bridges.conf
1677971999: Loading config file /mosquitto/config/sections/logging.conf
1677971999: Loading config file /mosquitto/config/sections/persistence.conf
1677971999: Loading config file /mosquitto/config/sections/security.conf
1677971999: Error: Unable to write pid file.