[27.x backport] Try to load kernel modules, without modprobe#49043
Merged
[27.x backport] Try to load kernel modules, without modprobe#49043
Conversation
An ioctl() call to get the "interface index" for a kernel module triggers the kernel to try to load the module, if the process is running with CAP_SYS_MODULE. This tends to be more reliable than "modprobe" for docker-in-docker. If the ioctl() method fails, fall back to trying "modprobe". Signed-off-by: Rob Murray <[email protected]> (cherry picked from commit 4740820) Signed-off-by: Rob Murray <[email protected]>
Signed-off-by: Rob Murray <[email protected]> (cherry picked from commit f2e1f52) Signed-off-by: Rob Murray <[email protected]>
dockerd will now do this itself, if ip6tables is enabled. Signed-off-by: Rob Murray <[email protected]> (cherry picked from commit 2af19b6) Signed-off-by: Rob Murray <[email protected]>
These modprobes were added as a workaround in commit cce5dfe, but dockerd should now be able to load the modules it needs. Signed-off-by: Rob Murray <[email protected]> (cherry picked from commit 15ba03c) Signed-off-by: Rob Murray <[email protected]>
akerouanton
approved these changes
Dec 6, 2024
Member
|
Temporarily moving to draft while we decide whether this still should be in 27.4.0, or if we keep it for 27.4.1 |
Member
|
(PR itself LGTM) |
vvoland
approved these changes
Dec 13, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
- What I did
When running in a container (docker-in-docker), the host may not have required kernel modules loaded.
Try to trigger the module load using an
ioctl()call, thenmodprobeif that doesn't work.This should make IPv6 networks work in GitHub Codespaces / devcontainers:
This is based on the DinD official image's method of loading modules using
ip link show, which was inspired by https://twitter.com/lucabruno/status/902934379835662336- How I did it
ip6_tables.- How to verify it
On a Debian 12.5 host, running dockerd
27.3.1, with systemd ...ip6_tablesnot loaded on the host (the host doesn't need it, because the daemon'sip6tablescommands use a (deprecated) dbus interface to send raw firewall commands.ip6_tablesmodule wasn't loaded.ip6tablesenabled by-default.ioctlmethod:DEBU[2024-12-05T11:30:36.095500049Z] Modules loaded loadErrors="<nil>" loader=ioctl modules=ip6_tablesDEBU[2024-12-05T11:31:59.533424067Z] Modules already loaded modules=ip6_tablesDEBU[2024-12-05T11:31:59.590301221Z] Modules already loaded modules="nf_conntrack,nf_conntrack_netlink"To check error logging, and fallback to modprobe:
Resulted in:
- Description for the changelog