Skip to content

Commit 8fc69f4

Browse files
[docker-in-docker] Use iptables-legacy only if it's working
Currently, docker-in-docker configures `iptables` to use `iptables-legacy` if it exists. However, if the `ip_tables` kernel module is not loaded on the host, `iptables-legacy` will not work. With this change, docker-in-docker checks if `iptables-legacy` works before using `update-alternatives`. Fixes #1235
1 parent e3e3ed7 commit 8fc69f4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/docker-in-docker/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ if ! type git > /dev/null 2>&1; then
218218
fi
219219

220220
# Swap to legacy iptables for compatibility
221-
if type iptables-legacy > /dev/null 2>&1; then
221+
if type iptables-legacy > /dev/null 2>&1 && iptables-legacy -L > /dev/null 2>&1; then
222222
update-alternatives --set iptables /usr/sbin/iptables-legacy
223223
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
224224
fi

0 commit comments

Comments
 (0)