compose
compose copied to clipboard
Strip empty DNS entries to avoid Moby parse errors when creating sandbox DNS
What I did
Ensured that each service's DNS settings are stripped from empty entries that could result from using ENV variables that defaulted to blank strings.
For example:
service:
# ANOTHER_SERVICE_IP is not set and defaults to blank string
dns: ${ANOTHER_SERVICE_IP}
...
Related issue https://github.com/docker/compose/issues/11690
Is there anything I could do to help move this PR forward?
Implementation is correct but IMHO this issue will apply to way more places, not just dns. We miss a way to mark an entry in compose.yaml as "to be ignored if value is empty". I wonder it would be better we introduce a global mechanism for this purpose, maybe comparable to !override:
service:
# ANOTHER_SERVICE_IP is not set and defaults to blank string
dns: !omitempty ${ANOTHER_SERVICE_IP}
...