Skip to content

[docker-in-docker] docker-init.sh prints grep: /proc/modules: No such file or directory on kernels without loadable-module support #1770

Open

Description

@afrossard

With iptablesSwitchAtRuntime at its default of true, docker-init.sh prints an error on every start when the kernel is built without loadable-module support, because /proc/modules doesn't exist there.

The check is in src/docker-in-docker/install.sh:

if type iptables-legacy > /dev/null 2>&1 \
   && { grep -qE '^(ip_tables)\b' /proc/modules \
        || [ -d /sys/module/ip_tables ]; } \

grep -q doesn't suppress the error for a missing file, so the message goes to stderr:

grep: /proc/modules: No such file or directory

The backend selection still works: the grep fails, the /sys/module check runs next, and the script falls through to iptables-nft.
So this is only noise, but it looks like a failure to anyone reading container startup output.

Reproduction: feature version 4.1.3, in a microsandbox (msb 0.7.13) guest on kernel 6.12.113, built without loadable modules.
Any container or VM on such a kernel should behave the same.

Suggested fix: silence that one grep, leaving the rest of the logic as it is:

   && { grep -qE '^(ip_tables)\b' /proc/modules 2>/dev/null \

Related: #1709 concerns the same iptablesSwitchAtRuntime check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions