File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 33set -euo pipefail
44c=$' \n\t '
55
6- # since alpine version 3.19.0 iptables-nft is used by default (https://wiki.alpinelinux.org/wiki/Release_Notes_for_Alpine_3.19.0),
7- # however this causes compatibility issues for hosts with older kernels (e.g. Windows > https://github.com/microsoft/WSL/issues/6044),
6+ # since alpine version 3.19.0 iptables-nft is used by default (https://wiki.alpinelinux.org/wiki/Release_Notes_for_Alpine_3.19.0),
7+ # however this causes compatibility issues for hosts with older kernels (e.g. Windows > https://github.com/microsoft/WSL/issues/6044),
88# therefore we still use iptables-legacy
99alias iptables=iptables-legacy
10+ if iptables-nft -L -n > /dev/null 2>&1 ; then
11+ alias iptables=iptables-nft
12+ fi
1013
1114# --- Ensure container network capabilities ----------------------------------
1215
@@ -83,13 +86,13 @@ for forwarding_port in $PORTS
8386do
8487 docker_container_port=" ${forwarding_port%%:* } "
8588 docker_host_port=" ${forwarding_port#*: } "
86-
89+
8790 # nft add rule nat prerouting tcp \
8891 # dport "${docker_container_port}" \
8992 # dnat to "$docker_host_ip:$docker_host_port"
9093 iptables --table nat --insert PREROUTING \
9194 --protocol tcp --destination-port " ${docker_container_port/ -/: } " \
92- --jump DNAT --to-destination " $docker_host_ip :$docker_host_port "
95+ --jump DNAT --to-destination " $docker_host_ip :$docker_host_port "
9396
9497 # nft add rule nat prerouting udp \
9598 # dport "${docker_container_port}" \
You can’t perform that action at this time.
0 commit comments