You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
656 B
28 lines
656 B
1 year ago
|
#!/bin/bash
|
||
|
currentAttempt=0
|
||
|
totalAttempts=10
|
||
|
delay=15
|
||
|
|
||
7 months ago
|
while [ $currentAttempt -lt $totalAttempts ]; do
|
||
|
currentAttempt=$(($currentAttempt + 1))
|
||
1 year ago
|
|
||
7 months ago
|
echo "Attempt $currentAttempt of $totalAttempts..."
|
||
1 year ago
|
|
||
7 months ago
|
result=$(iptables-save)
|
||
1 year ago
|
|
||
7 months ago
|
if [[ $result =~ "-A DOCKER -i docker0 -j RETURN" ]]; then
|
||
|
echo "Docker rules found! Modifying..."
|
||
1 year ago
|
|
||
7 months ago
|
iptables -t nat -A PREROUTING -m addrtype --dst-type LOCAL -j DOCKER
|
||
|
iptables -t nat -A PREROUTING -m addrtype --dst-type LOCAL ! --dst 127.0.0.0/8 -j DOCKER
|
||
1 year ago
|
|
||
7 months ago
|
echo "Done!"
|
||
1 year ago
|
|
||
7 months ago
|
break
|
||
|
fi
|
||
1 year ago
|
|
||
7 months ago
|
echo "Docker rules not found! Sleeping for $delay seconds..."
|
||
1 year ago
|
|
||
7 months ago
|
sleep $delay
|
||
|
done
|