fix: Handle missing Docker DNS rules gracefully in firewall script
Add error handling for grep when no Docker DNS rules exist, preventing script failure on default Docker networks while still preserving DNS functionality on custom networks. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
78e0785950
commit
dde41f6225
1 changed files with 1 additions and 1 deletions
|
|
@ -3,7 +3,7 @@ set -euo pipefail # Exit on error, undefined vars, and pipeline failures
|
|||
IFS=$'\n\t' # Stricter word splitting
|
||||
|
||||
# 1. Extract Docker DNS info BEFORE any flushing
|
||||
DOCKER_DNS_RULES=$(iptables-save -t nat | grep "127\.0\.0\.11")
|
||||
DOCKER_DNS_RULES=$(iptables-save -t nat | grep "127\.0\.0\.11" || true)
|
||||
|
||||
# Flush existing rules and delete existing ipsets
|
||||
iptables -F
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue