Skip to content

Commit e296eb4

Browse files
docs: Revise docs for the OVERRIDE_HOSTNAME ENV (docker-mailserver#4492)
Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
1 parent 8fa6e6d commit e296eb4

3 files changed

Lines changed: 22 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file. The format
1010

1111
- **Environment Variables:**
1212
- [ENV can be declared with a `__FILE` suffix](https://docker-mailserver.github.io/docker-mailserver/v15.1/config/environment/) to read a value from a file during initial DMS setup scripts ([#4359](https://github.com/docker-mailserver/docker-mailserver/pull/4359))
13+
- Improved docs for the ENV `OVERRIDE_HOSTNAME` ([#4492](https://github.com/docker-mailserver/docker-mailserver/pull/4492))
1314
- **Internal:**
1415
- [`DMS_CONFIG_POLL`](https://docker-mailserver.github.io/docker-mailserver/v15.0/config/environment/#dms_config_poll) supports adjusting the polling rate (seconds) for the change detection service `check-for-changes.sh` ([#4450](https://github.com/docker-mailserver/docker-mailserver/pull/4450))
1516

docs/content/config/environment.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,23 @@ title: Environment Variables
1414

1515
##### OVERRIDE_HOSTNAME
1616

17-
If you can't set your hostname (_eg: you're in a container platform that doesn't let you_) specify it via this environment variable. It will have priority over `docker run --hostname`, or the equivalent `hostname:` field in `compose.yaml`.
17+
If you cannot set your DMS FQDN as your hostname (_eg: you're in a container runtime lacks the equivalent of Docker's `--hostname`_), specify it via this environment variable.
1818

19-
- **empty** => Uses the `hostname -f` command to get canonical hostname for DMS to use.
19+
- **empty** => Internally uses the `hostname --fqdn` command to get the canonical hostname assigned to the DMS container.
2020
- => Specify an FQDN (fully-qualified domain name) to serve mail for. The hostname is required for DMS to function correctly.
2121

22+
!!! info
23+
24+
`OVERRIDE_HOSTNAME` is checked early during DMS container setup. When set it will be preferred over querying the containers hostname via the `hostname --fqdn` command (_configured via `docker run --hostname` or the equivalent `hostname:` field in `compose.yaml`_).
25+
26+
!!! warning "Compatibility may differ"
27+
28+
`OVERRIDE_HOSTNAME` is not a complete replacement for adjusting the containers configured hostname. It is a best effort workaround for supporting deployment environments like Kubernetes or when using Docker with `--network=host`.
29+
30+
Typically this feature is only useful when software supports configuring a specific hostname to use, instead of a default fallback that infers the hostname (such as retrieving the hostname via libc / NSS). [Fetchmail is known to be incompatible][gh--issue::hostname-compatibility] with this ENV, requiring manual workarounds.
31+
32+
Compatibility differences are being [tracked here][gh-issue::dms-fqdn] as they become known.
33+
2234
##### LOG_LEVEL
2335

2436
Set the log level for DMS. This is mostly relevant for container startup scripts and change detection event feedback.
@@ -1183,3 +1195,5 @@ Provide the credentials to use with `RELAY_HOST` or `DEFAULT_RELAY_HOST`.
11831195
[postfix-config::relayhost_maps]: https://www.postfix.org/postconf.5.html#sender_dependent_relayhost_maps
11841196
[postfix-config::sasl_passwd]: https://www.postfix.org/postconf.5.html#smtp_sasl_password_maps
11851197
[gh-issue::tls-legacy-workaround]: https://github.com/docker-mailserver/docker-mailserver/pull/2945#issuecomment-1949907964
1198+
[gh-issue::hostname-compatibility]: https://github.com/docker-mailserver/docker-mailserver-helm/issues/168#issuecomment-2911782106
1199+
[gh-issue::dms-fqdn]: https://github.com/docker-mailserver/docker-mailserver/issues/3520#issuecomment-1700191973

mailserver.env

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
# --- General Section ---------------------------
1010
# -----------------------------------------------
1111

12-
# empty => uses the `hostname` command to get the mail server's canonical hostname
13-
# => Specify a fully-qualified domainname to serve mail for. This is used for many of the config features so if you can't set your hostname (e.g. you're in a container platform that doesn't let you) specify it in this environment variable.
12+
# **empty** => Internally uses the `hostname --fqdn` command to get the canonical hostname assigned to the DMS container.
13+
# => Specify an FQDN (fully-qualified domain name) to serve mail for. The hostname is required for DMS to function correctly
14+
#
15+
# **WARNING**: Setting OVERRIDE_HOSTNAME can have difficult to predict side effects:
16+
# https://docker-mailserver.github.io/docker-mailserver/latest/config/environment/#override_hostname
1417
OVERRIDE_HOSTNAME=
1518

16-
# REMOVED in version v11.0.0! Use LOG_LEVEL instead.
17-
DMS_DEBUG=0
18-
1919
# Set the log level for DMS.
2020
# This is mostly relevant for container startup scripts and change detection event feedback.
2121
#

0 commit comments

Comments
 (0)