summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryyamashita <yyamashita@hetzner.yyamashita.com>2026-06-01 21:30:03 +0900
committeryyamashita <yyamashita@hetzner.yyamashita.com>2026-06-01 21:30:03 +0900
commit15e286a5a8490960d0f94a0c22bba67912f1cdb6 (patch)
tree26dbb6182f04f796552e5a9349499a9e259814ba
parente95b343d694acba88cc08fb8e7092d54b3ee6cd3 (diff)
entrypoint: fix DNS via cat-to-bind-mount (no python3/sed needed)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
-rwxr-xr-xmail/entrypoint.sh14
1 files changed, 5 insertions, 9 deletions
diff --git a/mail/entrypoint.sh b/mail/entrypoint.sh
index a8b87b4..8bd6ea1 100755
--- a/mail/entrypoint.sh
+++ b/mail/entrypoint.sh
@@ -14,15 +14,11 @@ if [[ ! -f "$KEY_FILE" ]]; then
exit 1
fi
-# Docker の embedded DNS (127.0.0.11) は MX クエリを解決できないことがあるため
-# 外部 DNS に差し替える(sed -i は bind mount で失敗するため python3 で書き換え)
-python3 - << 'PYEOF'
-path = '/etc/resolv.conf'
-content = open(path).read().replace('nameserver 127.0.0.11', 'nameserver 8.8.8.8')
-if '1.1.1.1' not in content:
- content += 'nameserver 1.1.1.1\n'
-open(path, 'w').write(content)
-PYEOF
+# Docker の embedded DNS (127.0.0.11) は MX クエリを正しく処理できないことがあるため
+# 外部 DNS に差し替える(sed -i は bind mount で失敗するため cat 経由で上書き)
+grep -v 'nameserver 127.0.0.11' /etc/resolv.conf > /tmp/resolv.new
+printf 'nameserver 8.8.8.8\nnameserver 1.1.1.1\n' >> /tmp/resolv.new
+cat /tmp/resolv.new > /etc/resolv.conf
# Start rsyslog for Postfix logging
rsyslogd