mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
Dev container: try to load kernel module ip6_tables
On an nftables host, the ip6_tables kernel module may not be loaded, but it needs to be for dockerd to run (with ip6tables now enabled by default). If ip6tables doesn't work, try the dind official image's trick for loading the module using "ip link show". Signed-off-by: Rob Murray <rob.murray@docker.com>
This commit is contained in:
@@ -91,6 +91,19 @@ if [ -n "$DOCKER_ROOTLESS" ]; then
|
||||
)
|
||||
fi
|
||||
|
||||
# On a host using nftables, the ip6_tables kernel module may need to be loaded.
|
||||
# This trick is borrowed from the docker (dind) official image ...
|
||||
# "modprobe" without modprobe
|
||||
# https://twitter.com/lucabruno/status/902934379835662336
|
||||
# This isn't 100% fool-proof, but it'll have a much higher success rate than
|
||||
# simply using the "real" modprobe (which isn't installed in the dev container).
|
||||
if ! ip6tables -nL > /dev/null 2>&1; then
|
||||
ip link show ip6_tables > /dev/null 2>&1 || true
|
||||
if ! ip6tables -nL > /dev/null 2>&1; then
|
||||
echo >&2 'ip6tables is not available'
|
||||
fi
|
||||
fi
|
||||
|
||||
set -x
|
||||
# shellcheck disable=SC2086
|
||||
exec "${dockerd[@]}" "${args[@]}"
|
||||
|
||||
Reference in New Issue
Block a user