Seems that $ is being escaped in the translation from containers/<container>.conf to the container environment.
Container config:
## Allowed IPs for Prometheus metrics
DISCOURSE_PROMETHEUS_TRUSTED_IP_ALLOWLIST_REGEX: "^10.20.20.5$"
Container environment.
declare -x DISCOURSE_PROMETHEUS_TRUSTED_IP_ALLOWLIST_REGEX="^10.20.20.5\$"